public void TestSendEmail() { String fromEmail = TestContext.DataRow["FromEmail"].ToString(); String fromName = TestContext.DataRow["FromName"].ToString(); String toEmail = TestContext.DataRow["ToEmail"].ToString(); String subject = TestContext.DataRow["Subject"].ToString(); String body = TestContext.DataRow["Body"].ToString(); Boolean isHighImportance = Convert.ToBoolean(TestContext.DataRow["IsHighImportance"]); String expectedResult = TestContext.DataRow["Result"].ToString(); Email email = new Email { FromEmail = fromEmail, FromName = fromName, ToEmail = toEmail, Subject = subject, Body = body, IsHighImportance = isHighImportance }; string actualResult = email.SendEmail(); Assert.IsTrue(actualResult.Contains(expectedResult), actualResult); }
/// <summary> /// Sends an email to the user with verification link. /// </summary> private void SendVerificationEmail(String userId, IContentLocator contentLocator) { String filePath = contentLocator.GetPath("~/Content/documents/VerifyAccount.html"); string emailContent = File.ReadAllText(filePath) .Replace("%FirstName%", this.User.FirstName) .Replace("%UserId%", userId); Email email = new Email { FromEmail = "*****@*****.**", FromName = "Crime Buster Admin", ToEmail = this.User.Email, Subject = "[Crime Busters] Please Verify Your Account", Body = emailContent, IsHighImportance = true }; email.SendEmail(); }