Say I have the following method that sends emails. I know I should have tests for the different status codes returned. I am also testing if the the methods CreateMail() and Send() are being called.
I guess in the end what's important is if the success status is returned or not. Should I be testing if these methods are being called or not ?
public void SendMail(Model model, out Status status)
{
if (!MyValidator.IsValidEmailAddress(model.EmailRecipient))
{
status = Status.InvalidEmailAddress;
return;
}
// code removed for clarity
IEmailMessage email = _emailMessageBuilder.CreateMail(model);
_mailerClient.Send(email);
status = Status.Success;
}
[TestMethod]
public void SendMail_CreateMailGetsCalledOnce()
{ ... }
[TestMethod]
public void SendMail_SendGetsCalledOnce()
{ ... }