During TDD training based on medical software case we are implementing the following story: "When user presses Save button, system should add patient, add device and add device data records".
The final implementation will look something like this:
if (_importDialog.Show() == ImportDialogResult.SaveButtonIsPressed)
{
AddPatient();
AddDevice();
AddDeviceDataRecords();
}
We have two ways to implement it:
- Three tests where each verifies one method (AddPatient, AddDevice, AddDeviceDataRecords) was called
- One test which verifies all three methods were called
In the first case if something wrong is happend to if clause condition, all three tests will fail. But in the second case if test fails, we are not sure what is exactly wrong. What way would you prefer.