Esempio n. 1
0
        public void TestNonCommunityMemberLoginCommunitySite()
        {
            // Create a community.

            CommunityTestData data = TestCommunity.Scouts.GetCommunityTestData();
            var community          = data.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            // Create a member with no community.

            Member member = CreateMember(null, 0);

            // Go to the community home page - branding should remain the entire way through.

            Get(GetCommunityUrl(community, ""));
            AssertUrl(HomeUrl);
            AssertHeader(data.HeaderSnippet);

            // Login.

            LogIn(member);
            AssertUrl(LoggedInMemberHomeUrl);
            AssertHeader(data.HeaderSnippet);

            // Logout.

            LogOut();
            AssertUrl(HomeUrl);
            AssertHeader(data.HeaderSnippet);
        }
Esempio n. 2
0
        public void TestCommunityMemberLoginCommunitySite()
        {
            // Create a community.

            CommunityTestData data = TestCommunity.Scouts.GetCommunityTestData();
            var community          = data.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            // Create a member for that community.

            Member member = CreateMember(community, 0);

            // Go to the community home page.

            Get(GetCommunityUrl(community, ""));
            AssertUrl(HomeUrl);
            AssertHeader(data.HeaderSnippet);

            // Login.

            LogIn(member);
            AssertUrl(LoggedInMemberHomeUrl);
            AssertHeader(data.HeaderSnippet);

            // Logout.

            LogOut();
            AssertUrl(HomeUrl);
            AssertHeader(data.HeaderSnippet);
        }
Esempio n. 3
0
        private void TestToMember(CommunityTestData fromData, bool isFromDeleted, CommunityTestData toData, bool isToDeleted, string expectedSnippet, string expectedHeaderSnippet)
        {
            var inviter = CreateInviter(fromData, isFromDeleted);

            // Invite member.

            var invitee = _memberAccountsCommand.CreateTestMember(1);

            if (toData != null)
            {
                var community = toData.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

                if (isToDeleted)
                {
                    var vertical = _verticalsCommand.GetVertical(community);
                    vertical.IsDeleted = true;
                    _verticalsCommand.UpdateVertical(vertical);
                }

                _memberAffiliationsCommand.SetAffiliation(invitee.Id, community.Id);
            }

            var invitation = new FriendInvitation {
                InviterId = inviter.Id, InviteeId = invitee.Id
            };

            _memberFriendsCommand.SendInvitation(invitation);

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(inviter, Return, invitee);
            AssertEmail(email, expectedSnippet, expectedHeaderSnippet);
        }
Esempio n. 4
0
        public void TestCommunityMemberLoginNonCommunitySite()
        {
            // Create a community.

            CommunityTestData firstData = TestCommunity.Scouts.GetCommunityTestData();
            var community = firstData.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            // Create a member for the community.

            Member member = CreateMember(community, 0);

            // Go to the home page - branding should only appear when the user logs in.

            Get(HomeUrl);
            AssertUrl(HomeUrl);
            AssertNoHeader(firstData.HeaderSnippet);

            // Login.

            LogIn(member);
            AssertUrl(LoggedInMemberHomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Logout, branding should stay.

            LogOut();
            AssertUrl(HomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Create another community and member.

            const TestCommunity secondData = TestCommunity.Rcsa;

            community = secondData.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);
            member    = CreateMember(community, 1);

            // Go to the home page - branding should not change.

            Get(HomeUrl);
            AssertUrl(HomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Login.

            LogIn(member);
            AssertUrl(LoggedInMemberHomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Logout, branding should go away.

            LogOut();
            AssertUrl(HomeUrl);
            AssertHeader(firstData.HeaderSnippet);
        }
Esempio n. 5
0
        protected Community CreateTestCommunity(CommunityTestData data, bool isDeleted)
        {
            var community = data.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            if (isDeleted)
            {
                var vertical = _verticalsCommand.GetVertical(community);
                vertical.IsDeleted = true;
                _verticalsCommand.UpdateVertical(vertical);
            }

            return(community);
        }
Esempio n. 6
0
        private Member CreateInviter(CommunityTestData fromData, bool isFromDeleted)
        {
            var inviter = _memberAccountsCommand.CreateTestMember(0);

            if (fromData != null)
            {
                var community = fromData.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

                if (isFromDeleted)
                {
                    var vertical = _verticalsCommand.GetVertical(community);
                    vertical.IsDeleted = true;
                    _verticalsCommand.UpdateVertical(vertical);
                }

                _memberAffiliationsCommand.SetAffiliation(inviter.Id, community.Id);
                inviter.AffiliateId = community.Id;
            }

            return(inviter);
        }