示例#1
0
        public void TestRepresentative()
        {
            var employer = CreateEmployer(0);

            _allocationsCommand.CreateAllocation(new Allocation {
                CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer.Id
            });

            var member1 = CreateMember(1);
            var member2 = CreateMember(2);

            _representativesCommand.CreateRepresentative(member1.Id, member2.Id);

            // Create messages.

            var templateMessage = new ContactMemberMessage {
                Subject = Subject, Body = Body
            };

            _employerMemberContactsCommand.ContactMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member1), templateMessage);

            // Check.

            var messages = _employerMemberContactsQuery.GetMessages(employer, member1.Id);

            Assert.AreEqual(1, messages.Count);
            AssertMessage(templateMessage, messages[0], member2.Id, _employerContactsRepository.GetMemberMessageRepresentative(messages[0].Id));
        }
        public void TestRepresentative()
        {
            var member  = _membersCommand.CreateTestMember(0);
            var friends = CreateFriends(member.Id, 1, 3);

            // Hide.

            friends[1].VisibilitySettings.Personal.FirstDegreeVisibility = friends[1].VisibilitySettings.Personal.FirstDegreeVisibility.ResetFlag(PersonalVisibility.Name);
            _membersCommand.UpdateMember(friends[1]);
            AssertFriends(member.Id, friends.Take(1).Concat(friends.Skip(2).Take(1)).ToList(), friends.Skip(1).Take(1));

            // Make a representative.

            _representativesCommand.CreateRepresentative(member.Id, friends[1].Id);
            AssertFriends(member.Id, friends, new Member[0]);

            // Unhide.

            friends[1].VisibilitySettings.Personal.FirstDegreeVisibility = friends[1].VisibilitySettings.Personal.FirstDegreeVisibility.SetFlag(PersonalVisibility.Name);
            _membersCommand.UpdateMember(friends[1]);
            AssertFriends(member.Id, friends, new Member[0]);

            // Hide.

            friends[1].VisibilitySettings.Personal.FirstDegreeVisibility = friends[1].VisibilitySettings.Personal.FirstDegreeVisibility.ResetFlag(PersonalVisibility.Name);
            _membersCommand.UpdateMember(friends[1]);
            AssertFriends(member.Id, friends, new Member[0]);

            // Delete representative.

            _representativesCommand.DeleteRepresentative(member.Id, friends[1].Id);
            AssertFriends(member.Id, friends.Take(1).Concat(friends.Skip(2).Take(1)).ToList(), friends.Skip(1).Take(1));
        }
示例#3
0
        public void TestRepresentativeFriendsFriends()
        {
            var member        = _membersCommand.CreateTestMember(0);
            var friends       = CreateFriends(member.Id, 1, 2);
            var friendsFriend = CreateFriends(friends[0].Id, 3, 1)[0];

            AssertFriendsFriends(
                member.Id,
                new Dictionary <Guid, Guid[]>
            {
                { friendsFriend.Id, new[] { friends[0].Id } }
            },
                new[] { friends[0].Id, friends[1].Id });

            // Hide.

            friends[0].VisibilitySettings.Personal.FirstDegreeVisibility = friends[0].VisibilitySettings.Personal.FirstDegreeVisibility.ResetFlag(PersonalVisibility.Name);
            _membersCommand.UpdateMember(friends[0]);
            AssertFriendsFriends(member.Id, new Dictionary <Guid, Guid[]>(), new[] { friends[0].Id, friends[1].Id, friendsFriend.Id });

            // Add as representative.

            _representativesCommand.CreateRepresentative(member.Id, friends[0].Id);
            AssertFriendsFriends(
                member.Id,
                new Dictionary <Guid, Guid[]>
            {
                { friendsFriend.Id, new[] { friends[0].Id } }
            },
                new[] { friends[0].Id, friends[1].Id });
        }
示例#4
0
        public void TestCreateRepresentative()
        {
            var representeeId    = Guid.NewGuid();
            var representativeId = Guid.NewGuid();

            // Create.

            _representativesCommand.CreateRepresentative(representeeId, representativeId);
            AssertRepresentative(representeeId, representativeId);
            AssertRepresentees(representativeId, representeeId);
        }
示例#5
0
        public void TestRepresentative()
        {
            var member = _membersCommand.CreateTestMember(0);
            var friend = _membersCommand.CreateTestMember(1);

            _networkingCommand.CreateFirstDegreeLink(member.Id, friend.Id);
            _representativesCommand.CreateRepresentative(member.Id, friend.Id);

            // Member views representative.

            var views = new PersonalViews(new PersonalView(friend, PersonalContactDegree.Representative, PersonalContactDegree.FirstDegree));

            AssertViews(member.Id, views, friend);

            // Representative views member.

            views = new PersonalViews(new PersonalView(member, PersonalContactDegree.Representee, PersonalContactDegree.FirstDegree));
            AssertViews(friend.Id, views, member);
        }
示例#6
0
        public void TestRepresentative()
        {
            var       member = _memberAccountsCommand.CreateTestMember(0);
            Member    friend;
            Candidate candidate;
            Resume    resume;

            CreateFriend(member.Id, out friend, out candidate, out resume);
            _representativesCommand.CreateRepresentative(member.Id, friend.Id);

            // Log in.

            LogIn(member);
            GetPage <ViewFriend>(ViewFriend.FriendIdParameter, friend.Id.ToString());

            // Check text and link are visible.

            AssertPageContains(friend.FirstName + " is my nominated representative.");
            Assert.IsTrue(_lnkRemoveRepresentative.IsVisible);
            Assert.IsTrue(_btnRemoveRepresentative.IsVisible);
        }
示例#7
0
        public void TestRepresentative()
        {
            // Create the member and friends.

            var member = CreateMember(0);
            const PersonalVisibility access = PersonalVisibility.Name | PersonalVisibility.CurrentJobs | PersonalVisibility.CandidateStatus | PersonalVisibility.Suburb | PersonalVisibility.CountrySubdivision | PersonalVisibility.Interests;

            IList <Member>    friends;
            IList <Candidate> candidates;
            IList <Resume>    resumes;

            CreateFriends(member.Id, access, 1, 1, out friends, out candidates, out resumes);
            _representativesCommand.CreateRepresentative(member.Id, friends[0].Id);

            // Log in.

            LogIn(member);
            GetPage <ViewFriends>();

            AssertFriends(friends, candidates, resumes);
            AssertPageDoesNotContain("Represented by me");
            AssertPageContains("My nominated representative");
        }
示例#8
0
        void IMemberFriendsCommand.AcceptInvitation(Guid inviteeId, RepresentativeInvitation invitation)
        {
            _representativeInvitationsCommand.AcceptInvitation(inviteeId, invitation);

            // Since the invitee is accepting the invitation make them a representative.

            _representativesCommand.CreateRepresentative(invitation.InviterId, inviteeId);

            // Also, make them friends.

            _networkingCommand.CreateFirstDegreeLink(invitation.InviterId, inviteeId);

            // Fire an event.

            var handlers = InvitationAccepted;

            if (handlers != null)
            {
                handlers(this, new EventArgs <Invitation>(invitation));
            }
        }