我有一个 void 功能,它发送电子邮件。我需要为此功能编写测试。如何才能做到这一点?
public void SendAdminMail(string subject, string body, string adminAddress)
{
var email = Email.
From(ConfigurationManager.AppSettings["Mail.NoReply.Address"].ToString(CultureInfo.InvariantCulture)).
To(adminAddress).
Subject(subject).
Body(body).
UsingClient(GetOfficeClient());
email.Message.SubjectEncoding = Encoding.UTF8;
email.Message.BodyEncoding = Encoding.UTF8;
email.Send();
}