1

I currently have some unit tests running against all of our controllers and actions, and an additional test for some "temporary exemptions" that we allow (but that receive other checks as a result).

We were able to remove all of our temporary exemptions (a good thing), but the functionality needs to remain in place for future use.

However, since the TestCaseSource is now empty, NUnit fails the test with "no arguments were provided".

I don't necessarily disagree with the behavior, but given my situation, is there any way to ignore the test only when the TestCaseSource is empty, rather than failing with this message?

SeanKilleen
  • 8,809
  • 17
  • 80
  • 133

1 Answers1

0

There is no way to ensure that the functionality remains in place unless you have a test for it. So it's best to keep at least one test.

I can't give you details, since I don't know how your exemptions work, but I'd try to create a fake exemption that uses whatever underlying "exemption functionality" you have implemented. The fake class/classses needed to implement this should be a part of your tests, not of your SUT.

OTOH, if you prefer not to run the tests, just comment out the TestCaseSource attribute and remember to uncomment it when you are adding exemptions.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • Sorry, i think my description wasn't correct enough. Essentially, I have tests that utilize the temporary exemptions list -- e.g. "a temporary exemption cannot also have a permanent exemption". However, I don't currently have any temporary exemptions. The test is a valid one, but the temp exemptions list is now empty, so the TestCaseSource gives an error of "nothing provided" (even though that's expected at this point). Does that make more sense? – SeanKilleen Oct 03 '16 at 17:54
  • Is each of your test cases a list? In that case, provide an empty list for the case where there are no temp exemptions. If I'm not getting it, perhaps you could edit the question to include a code example. – Charlie Oct 04 '16 at 17:59
  • I think I'm definitely not being clear enough and will absolutely edit my answer include more information. Will ping again when I've done so. Thanks! – SeanKilleen Oct 04 '16 at 18:45