public void SendAccountApprovedMailShouldSendCorrectMailInfoToMailer()
        {
            var mock = new MembershipMailerMock();

            mock.MembershipMailer.SendAccountApprovedMail("en", "Test", "*****@*****.**");
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Your account for StrixIT Membership Tests has been approved",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>Your account for StrixIT Membership Tests has been approved</h1>
<p>Dear Test</p>
<p>Your account at StrixIT Membership Tests has been approved. You can now login <a href=""http://www.strixit.com/Account/Login"">here</a></p>
    <p><small>Powered by StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendAccountInformationMailShouldSendCorrectMailInfoToMailer()
        {
            var mock           = new MembershipMailerMock();
            var userId         = Guid.Parse("cb8191c4-8721-4e0d-ac6c-a8e1223b71b2");
            var verificationId = Guid.Parse("249b080e-4239-4212-bf6a-4813e5508999");

            mock.MembershipMailer.SendAccountInformationMail("en", "Test", "*****@*****.**", userId);
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Your account for StrixIT Membership Tests",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>Your account for StrixIT Membership Tests</h1>
<p>Dear Test</p>
<p>A new user account for StrixIT Membership Tests has been created for you. When you are ready to select a password, please click the link below. You'll then receive a new link that will allow you to enter a password.</p>
<a href=""http://www.strixit.com/Account/SendPasswordLink/cb8191c4-8721-4e0d-ac6c-a8e1223b71b2"">Select a password</a>
    <p><small>Powered by StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendMailForNonDefaultCultureWithLinkShouldSendCorrectMailInfoWithLocalizedUrlToMailer()
        {
            var mock           = new MembershipMailerMock();
            var verificationId = Guid.Parse("249b080e-4239-4212-bf6a-4813e5508999");

            mock.MembershipMailer.SendSetPasswordMail("nl", "Test", "*****@*****.**", verificationId);
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Kies uw wachtwoord voor StrixIT Membership Tests",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>Kies uw wachtwoord voor StrixIT Membership Tests</h1>
<p>Beste Test</p>
<p>U wilt een nieuw wachtwoord kiezen voor uw account op StrixIT Membership Tests. Klik op de onderstaande link om verder te gaan:</p>
<a href=""http://www.strixit.com/nl/Account/SetPassword/249b080e-4239-4212-bf6a-4813e5508999"">Kies uw wachtwoord</a>
    <p><small>Mogelijk gemaakt door het StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendMailWithEventThatOverwritesSubjectAndBodyShouldSendCorrectMailInfoToMailer()
        {
            var dependencyMock = new Mock <IDependencyInjector>();

            dependencyMock.Setup(d => d.GetAll <IHandlePlatformEvent <GeneralEvent> >()).Returns(new List <IHandlePlatformEvent <GeneralEvent> > {
                new MailHandler()
            });
            DependencyInjector.Injector = dependencyMock.Object;

            var mock = new MembershipMailerMock();

            mock.MembershipMailer.SendPasswordSetMail("en", "Test", "*****@*****.**");

            DependencyInjector.Injector = null;

            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "New password for StrixIT Membership Tests",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <p>Test, you have a new password: testtest!</p>
    <p><small>Powered by StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendMailForNonDefaultCultureShouldSendCorrectMailInfoToMailer()
        {
            var mock = new MembershipMailerMock();

            mock.MembershipMailer.SendPasswordSetMail("nl", "Test", "*****@*****.**");
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Uw nieuwe wachtwoord voor StrixIT Membership Tests is opgeslagen",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>Uw nieuwe wachtwoord voor StrixIT Membership Tests is opgeslagen</h1>
<p>Beste Test</p>
<p>Uw nieuwe wachtwoord voor uw account op StrixIT Membership Tests is opgeslagen.</p>
    <p><small>Mogelijk gemaakt door het StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendMailForDefaultCultureWhenSpecificTemplateExistsShouldSendCorrectMailInfoToMailer()
        {
            var mock     = new MembershipMailerMock();
            var baseName = string.Format("{0}\\Templates\\PasswordSetMail_en", StrixPlatform.Environment.WorkingDirectory);

            if (File.Exists(baseName + ".html"))
            {
                File.Move(baseName + ".html", baseName + "_inactive.html");
            }

            File.Move(baseName + "_inactive.html", baseName + ".html");
            mock.MembershipMailer.SendPasswordSetMail("en", "Test", "*****@*****.**");
            File.Move(baseName + ".html", baseName + "_inactive.html");
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Your password for StrixIT Membership Tests has been set",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>Your password for StrixIT Membership Tests has been set</h1>
<p>Hi Test</p>
<p>You have a new password for StrixIT Membership Tests.</p>
    <p><small>Powered by StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendSetPasswordMailShouldSendCorrectMailInfoToMailer()
        {
            var mock           = new MembershipMailerMock();
            var userId         = Guid.Parse("cb8191c4-8721-4e0d-ac6c-a8e1223b71b2");
            var verificationId = Guid.Parse("249b080e-4239-4212-bf6a-4813e5508999");

            mock.MembershipMailer.SendSetPasswordMail("en", "Test", "*****@*****.**", verificationId);
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Set your password for StrixIT Membership Tests",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>Set your password for StrixIT Membership Tests</h1>
<p>Dear Test</p>
<p>You have requested to set a new password for your account at StrixIT Membership Tests. Please click the link below to proceed:</p>
<a href=""http://www.strixit.com/Account/SetPassword/249b080e-4239-4212-bf6a-4813e5508999"">Set your password</a>
    <p><small>Powered by StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendPasswordSetMailShouldSendCorrectMailInfoToMailer()
        {
            var mock = new MembershipMailerMock();

            mock.MembershipMailer.SendPasswordSetMail("en", "Test", "*****@*****.**");
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Your password for StrixIT Membership Tests has been set",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>Your password for StrixIT Membership Tests has been set</h1>
<p>Dear Test</p>
<p>Your password for your account at StrixIT Membership Tests has been set.</p>
    <p><small>Powered by StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }
        public void SendEmailChangedMailShouldSendCorrectMailInfoToMailer()
        {
            var mock = new MembershipMailerMock();

            mock.MembershipMailer.SendEmailChangedMail("en", "Test", "*****@*****.**", "*****@*****.**");
            mock.MailerMock.Verify(m => m.SendMail(
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "Your e-mail address for StrixIT Membership Tests has been changed",
                                       @"<!DOCTYPE html>
<html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <meta charset=""utf-8"" />
    <title></title>
</head>
<body>
    <h1>StrixIT Web Platform</h1>
    <h1>E-mail changed mail</h1>
<p>Dear Test</p>
<p>Your e-mail address for your account at StrixIT Membership Tests has been changed from [email protected] to [email protected]. You will receive a verification mail at your new address.</p>
    <p><small>Powered by StrixIT Web Platform</small></p>
    <p>Copyright &copy; StrixIT</p>
</body>
</html>"), Times.Once());
        }