예제 #1
0
        public void Test_ConfirmEmail_Population()
        {

            //Arrange
            _usermailerMock.Setup(
                mailer => mailer.PopulateBody(It.IsAny<MvcMailMessage>(), "ConfirmAccount", It.IsAny<string>(), null));
            var email = new EmailViewModel
            {
                From = "me",
                Url = "http://wwww.google.com",
                UrlText = "کلیک کنید",
                To = "*****@*****.**",
                Message = "سلام"

            };


            //Act
            var mailMessage = _usermailerMock.Object.ConfirmAccount(email);

            //Assert
            _usermailerMock.VerifyAll();
            var confirmAccountEmail = _usermailerMock.Object.ViewData.Model as EmailViewModel;
            if (confirmAccountEmail != null)
                Assert.AreEqual("me", confirmAccountEmail.From);
            Assert.AreEqual("*****@*****.**", mailMessage.To.First().ToString());


        }
예제 #2
0
파일: UserMailer.cs 프로젝트: rabbal/Mvc5
 public MvcMailMessage ConfirmAccount(EmailViewModel confirmAccountEmail)
 {
     ViewData.Model = confirmAccountEmail;
     return Populate(x =>
     {
         x.BodyTransferEncoding = System.Net.Mime.TransferEncoding.Base64;
         x.BodyEncoding = Encoding.UTF8;
         x.Body = confirmAccountEmail.Message;
         x.Subject = confirmAccountEmail.Subject;
         x.ViewName = confirmAccountEmail.ViewName;
         x.To.Add(confirmAccountEmail.To);
     });
 }
예제 #3
0
파일: UserMailer.cs 프로젝트: rabbal/Mvc5
 public MvcMailMessage ResetPassword(EmailViewModel resetPasswordEmail)
 {
     ViewData.Model = resetPasswordEmail;
     return Populate(x =>
     {
         x.BodyTransferEncoding = System.Net.Mime.TransferEncoding.Base64;
         x.BodyEncoding = Encoding.UTF8;
         x.Subject = resetPasswordEmail.Subject;
         x.ViewName = resetPasswordEmail.ViewName;
         x.Body = resetPasswordEmail.Message;
         x.To.Add(resetPasswordEmail.To);
     });
 }