The contents of the collection of test modules meet certain criteria using lambas / LINQ

I use the built-in C # testing classes, such as Assertand CollectionAssert. I want to verify that all objects returned by a method call have a specific value for this property.

Are there special classes for unit testing of this type, or would I just use the usual collection methods and pass the results to a regular call Assert?

eg. something like that:Assert.TrueForAll(myList,x => x.Prop == 123)

+4
source share
1 answer

How about returning the check?

mylist.ForEach(x => Assert.IsTrue(x.Prop == 123));
0
source

All Articles