I have a functions class that does various functions (shocking, I know). One such function is to return a list of public holidays for the given year(s). Each calculation has it's own private function, so the public function really just compiles the various holidays into a list.
Now I want to run some tests on this, obviously I can't run tests on the private methods, so I pull out the list in the TestInitialize method and then work with that for various tests.
The problem is, say I pull out New Year's Day with something like list.SingleOrDefault(p => p.HolidayName.Equals("New Year's Day"))
, it's then best to check if it's null or not before running the intended test (it should be on a weekday, which as far as I can tell is two asserts in itself...).
So, two questions I suppose.
1. Is this situation an exception to the rule 1 assert per unit test? Or do I need to separate out the null assertion and the weekend assertion?
2. As far as I can tell, there would be two assertions to make sure it's not on a weekend; one to check if day of week is not equal to saturday and one to check if day of week is not equal to sunday. Or am I wrong here?