Beispiel #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());


        }
Beispiel #2
0
 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);
     });
 }
Beispiel #3
0
 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);
     });
 }