In nunit, suppose we have more than one actual values for the specific function to return, how should I frame the assert function ? Which function should I use ?
Ex:
int function(..) {
.
.
.
a = some_operation();
if (a == 0)
result = 0;
else if (a == some_predefined_value)
result = 1;
else if (a == some_predefined_value)
result = 2;
else
correct_usage();
return result;
}
I think you may want to use
CollectionAssert. This lets you verify that a value or set of values is contained within another.You may notice that the first method is checking for the second argument in the first IEnumerable and the second is asserting that the first argument (
IEnumerable) is a subset of the second argument, also aIEnumerable.