Exemple #1
0
        public void TestChangeSecondaryEmailAddress()
        {
            var member = _memberAccountsCommand.CreateTestMember(0);

            member.EmailAddresses.Add(new EmailAddress {
                Address = SecondaryEmailAddress
            });
            _memberAccountsCommand.UpdateMember(member);
            _emailVerificationsCommand.VerifyEmailAddress(member.Id, SecondaryEmailAddress);

            // Should be activated and emails verified.

            var primaryEmailAddress   = member.EmailAddresses[0].Address;
            var secondaryEmailAddress = member.EmailAddresses[1].Address;

            AssertEmailAddress(member.Id, primaryEmailAddress, true, secondaryEmailAddress, true, true);

            LogIn(member);

            // Change.

            member.EmailAddresses = new[]
            {
                new EmailAddress {
                    Address = primaryEmailAddress
                },
                new EmailAddress {
                    Address = NewSecondaryEmailAddress
                },
            };
            Get(_settingsUrl);
            _emailAddressTextBox.Text          = primaryEmailAddress;
            _secondaryEmailAddressTextBox.Text = NewSecondaryEmailAddress;
            _saveButton.Click();

            // Check.

            AssertEmailAddress(member.Id, primaryEmailAddress, true, NewSecondaryEmailAddress, false, true);

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(Return, Return, new EmailRecipient(NewSecondaryEmailAddress, member.FullName));
            var url = GetEmailUrl(email.GetHtmlView().Body);

            // Navigate to the verification page.

            Get(url);
            AssertUrl(GetEmailUrl("VerificationEmail", _profileUrl));

            AssertEmailAddress(member.Id, primaryEmailAddress, true, NewSecondaryEmailAddress, true, true);
        }
Exemple #2
0
        public void TestChangeSecondaryEmailAddress()
        {
            var member    = CreateMember();
            var candidate = _candidatesQuery.GetCandidate(member.Id);

            member.EmailAddresses.Add(new EmailAddress {
                Address = SecondaryEmailAddress
            });
            _memberAccountsCommand.UpdateMember(member);
            _emailVerificationsCommand.VerifyEmailAddress(member.Id, SecondaryEmailAddress);

            // Should be activated and emails verified.

            var primaryEmailAddress   = member.EmailAddresses[0].Address;
            var secondaryEmailAddress = member.EmailAddresses[1].Address;

            AssertEmailAddress(member.Id, primaryEmailAddress, true, secondaryEmailAddress, true, true);

            LogIn(member);

            // Change.

            member.EmailAddresses = new[]
            {
                new EmailAddress {
                    Address = primaryEmailAddress
                },
                new EmailAddress {
                    Address = NewSecondaryEmailAddress
                }
            };
            var parameters = GetParameters(member, candidate, null);

            AssertJsonSuccess(ContactDetails(parameters));

            // Check.

            AssertEmailAddress(member.Id, primaryEmailAddress, true, NewSecondaryEmailAddress, false, true);

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(Return, Return, new EmailRecipient(NewSecondaryEmailAddress, member.FullName));
            var url = GetEmailUrl(email.GetHtmlView().Body);

            // Navigate to the verification page.

            Get(url);
            AssertUrl(GetEmailUrl("VerificationEmail", _profileUrl));

            AssertEmailAddress(member.Id, primaryEmailAddress, true, NewSecondaryEmailAddress, true, true);
        }
        public void TestVerifiedSecondaryEmailAddress()
        {
            var member = CreateMember();

            member.PhoneNumbers = null;
            member.EmailAddresses.Add(new EmailAddress {
                Address = SecondaryEmailAddress
            });
            _memberAccountsCommand.UpdateMember(member);
            _emailVerificationsCommand.VerifyEmailAddress(member.Id, SecondaryEmailAddress);

            var criteria = new MemberSearchCriteria();

            criteria.SetKeywords(BusinessAnalyst);

            Get(GetPartialSearchUrl(criteria));
            AssertMembers(member);

            // Bounce the email addresses.

            BounceEmail(FileSystem.GetAbsolutePath(@"Apps\AcceptanceTest\Employers\Search\Results\TestData\Primary.eml", RuntimeEnvironment.GetSourceFolder()));

            Get(GetPartialSearchUrl(criteria));
            AssertMembers(member);

            BounceEmail(FileSystem.GetAbsolutePath(@"Apps\AcceptanceTest\Employers\Search\Results\TestData\Secondary.eml", RuntimeEnvironment.GetSourceFolder()));

            Get(GetPartialSearchUrl(criteria));
            AssertMembers();

            // Verify.

            LogIn(member);
            AssertUrlWithoutQuery(_notVerifiedUrl);
            _resendVerificationEmailButton.Click();
            AssertUrlWithoutQuery(_verificationSentUrl);
            LogOut();
            var emails = _emailServer.AssertEmailsSent(2);
            var url    = GetEmailUrl(emails[1].GetHtmlView().Body);

            Get(url);
            AssertUrlWithoutQuery(_verificationUrl);

            // Search.

            Get(GetPartialSearchUrl(criteria));
            AssertMembers(member);
        }
Exemple #4
0
        private Member CreateMember(bool primaryEmailIsVerified, bool hasSecondaryEmail, bool secondaryEmailIsVerified)
        {
            var member = _memberAccountsCommand.CreateTestMember(0, true);

            if (!primaryEmailIsVerified)
            {
                _emailVerificationsCommand.UnverifyEmailAddress(member.EmailAddresses[0].Address, null);
            }

            if (hasSecondaryEmail)
            {
                member.EmailAddresses.Add(new EmailAddress {
                    Address = SecondaryEmailAddress
                });
                _memberAccountsCommand.UpdateMember(member);

                if (secondaryEmailIsVerified)
                {
                    _emailVerificationsCommand.VerifyEmailAddress(member.Id, member.EmailAddresses[1].Address);
                }
                else
                {
                    _emailVerificationsCommand.UnverifyEmailAddress(member.EmailAddresses[1].Address, null);
                }
            }

            return(member);
        }
        private Guid?Activate(Member member, EmailVerification emailVerification)
        {
            var emailAddress = (from a in member.EmailAddresses where string.Equals(a.Address, emailVerification.EmailAddress, StringComparison.InvariantCultureIgnoreCase) select a).SingleOrDefault();

            if (emailAddress == null)
            {
                return(null);
            }

            // Activate the account.

            _userAccountsCommand.ActivateUserAccount(member, member.Id);

            // Verify the email address.

            _emailVerificationsCommand.VerifyEmailAddress(member.Id, emailAddress.Address);

            return(member.Id);
        }
Exemple #6
0
        public void TestMidSessionVerification()
        {
            // Create an activation.

            var member = _memberAccountsCommand.CreateTestMember(0, true);

            _emailVerificationsCommand.UnverifyEmailAddress(member.EmailAddresses[0].Address, null);
            CreateVerification(member);

            // LogIn and try to go to a few pages.

            LogIn(member);
            AssertUrlWithoutQuery(_notVerifiedUrl);

            // Navigate to some pages to check that the account is not activated.

            Get(LoggedInMemberHomeUrl);
            AssertUrl(LoggedInMemberHomeUrl);
            GetPage <InviteFriends>();
            AssertPage <InviteFriends>();
            Get(_profileUrl);
            AssertUrl(_profileUrl);

            // Update the verification status but not through the browser.
            // This could be because a user verified their account through another browser instance.

            _emailVerificationsCommand.VerifyEmailAddress(member.Id, member.EmailAddresses[0].Address);

            // Navigate again.

            Get(LoggedInMemberHomeUrl);
            AssertUrl(LoggedInMemberHomeUrl);
            GetPage <InviteFriends>();
            AssertPage <InviteFriends>();
            Get(_profileUrl);
            AssertUrl(_profileUrl);
        }