I have a chunk of code that looks something like this:
function bool PassesBusinessRules()
bool meetsBusinessRules = false;
I believe there should be four unit tests for this particular function. Three to test each of the conditions in the if statement and ensure it returns false. And another test that makes sure the function returns true.
Question: Should there actually be ten unit tests instead? Nine that checks each of the possible failure paths. IE:
- False False False
- False False True
- False True False
And so on for each possible combination.
I think that is overkill, but some of the other members on my team do not. The way I look at it is if BusinessRule1 fails then it should always return false, it doesn't matter if it was checked first or last.