Hi, I have some code in my asp.net which sends an email:
public void SendEmail(string message)
{
var body = message;
var email = new MailMessage(ConfigurationManager.AppSettings["SenderEmail"],
ConfigurationManager.AppSettings["RecipientEmail"],
"Email Test", body);
var client = new SmtpClient();
client.Host = Properties.Settings.Default.smtp;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = CredentialCache.DefaultNetworkCredentials;
client.Send(email);
}
I'm wanting to know how to test this. Whether it is a unit test or integration test I really just don't care. I'm NOT wanting to mock this out. I'm actually wanting to write a test that an email is sent with the correct message.
Can anyone help me with this?