For every expect return value like 2 or 4 I want to pass this value as parameter for the unit test method. But I get an exception that the parameters are not correct. When I remove the countExpected parameter the unit test runs fine I just can not assert the countExpected...
Is this scenario possible at all with NUnit?
[Test, TestCaseSource("VisibleWeekDays")]
public void Test(DayOfWeek[] visibleWeekDaysSetup, int countExpected)
{
// ARRANGE
// ACT
// ASSERT
Assert.That(periods.Count(),Is.EqualTo(countExpected));
}
private static IEnumerable<TestCaseData> VisibleWeekDays
{
get
{
yield return new TestCaseData(new DayOfWeek[] {DayOfWeek.Sunday}).Returns(2);
yield return new TestCaseData(new DayOfWeek[] {DayOfWeek.Sunday, DayOfWeek.Monday}).Returns(4);
// more days...
}
}