Imagine I have a method:
void Method(bool parameter){
if(parameter){
// first case
} else {
// second case
}
}
Which is your preferred unit test organization method?
Option 1:
void MethodTest(){
// test first case
// test second case
}
or
Option 2:
void MethodTestFirstCase(){
// test first case
}
void MethodTestSecondCase(){
// test second case
}
In this case I’d test the two separately.
Having said that, I’m not dogmatic about the “test only one thing per test” approach. Sometimes it just makes more pragmatic sense to test multiple things in the same test – in particular if getting to one end point means going through another point, it’s sometimes okay to combine the two.
In this case you really would be testing two separate things rather than one on the way to another, so I’d split them up.