Exemplo n.º 1
0
        public void TestMember()
        {
            // Create a member.

            var member = CreateMember();

            // Create an email verification.

            var emailVerification = new EmailVerification {
                UserId = member.Id, EmailAddress = member.GetBestEmailAddress().Address
            };

            _emailVerificationsCommand.CreateEmailVerification(emailVerification);

            // Send the email.

            var templateEmail = new VerificationEmail(member, emailVerification);

            _emailsCommand.TrySend(templateEmail);

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(Return, Return, member);
            email.AssertSubject(GetSubject());
            email.AssertViewChecks(MediaTypeNames.Text.Html);
            email.AssertView(MediaTypeNames.Text.Html, GetBody(templateEmail, member, GetContent(templateEmail, member, emailVerification)));
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);
        }
Exemplo n.º 2
0
        void IAccountVerificationsCommand.ResendVerification(IRegisteredUser user, string emailAddress)
        {
            // Only supported for members at the moment.

            var member = user as IMember;

            if (member == null)
            {
                return;
            }

            // Find an existing verification or create a new one.

            var emailVerification = GetEmailVerification(member.Id, emailAddress);

            // Send the email.

            var email = new VerificationEmail(member, emailVerification);

            _emailsCommand.TrySend(email);
        }