Ejemplo n.º 1
0
        public void TestAddFirstDegreeContacts()
        {
            var member1 = _memberAccountsCommand.CreateTestMember(1);

            Assert.IsTrue(_memberContactsQuery.GetFirstDegreeContacts(member1.Id).Count == 0);

            var member2 = _memberAccountsCommand.CreateTestMember(2);

            _networkingCommand.CreateFirstDegreeLink(member1.Id, member2.Id);

            AssertFirstDegreeContacts(member1.Id, member2.Id);
        }
Ejemplo n.º 2
0
        void IMemberFriendsCommand.AcceptInvitation(Guid inviteeId, FriendInvitation invitation)
        {
            _networkingInvitationsCommand.AcceptInvitation(inviteeId, invitation);

            // Since the invitee is accepting the invitation make them friends.

            _networkingCommand.CreateFirstDegreeLink(invitation.InviterId, inviteeId);

            // Fire an event.

            var handlers = InvitationAccepted;

            if (handlers != null)
            {
                handlers(this, new EventArgs <Invitation>(invitation));
            }
        }
Ejemplo n.º 3
0
        public void TestSearchByEmailAddress()
        {
            var member = CreateMember();
            var friend = _membersCommand.CreateTestMember("*****@*****.**");

            friend.VisibilitySettings.Personal.Set(PersonalContactDegree.FirstDegree, PersonalVisibility.EmailAddress);
            _membersCommand.UpdateMember(friend);
            _networkingCommand.CreateFirstDegreeLink(member.Id, friend.Id);

            PerformSearch(member.Id, friend.GetBestEmailAddress().Address, friend);

            // Remove access to name so member should not be found.

            friend.VisibilitySettings.Personal.FirstDegreeVisibility = friend.VisibilitySettings.Personal.FirstDegreeVisibility.ResetFlag(PersonalVisibility.Name);
            _membersCommand.UpdateMember(friend);

            PerformSearch(member.Id, friend.GetBestEmailAddress().Address);
        }
Ejemplo n.º 4
0
        public void TestContactAlreadyInNetwork()
        {
            var contactOne   = _memberAccountsCommand.CreateTestMember("*****@*****.**", "Sideshow", "Bob");
            var contactTwo   = _memberAccountsCommand.CreateTestMember("*****@*****.**", "John", "Doe");
            var contactThree = _memberAccountsCommand.CreateTestMember("*****@*****.**", "Rambo", "Doe");

            _networkingCommand.CreateFirstDegreeLink(contactOne.Id, contactTwo.Id);

            var contactInNetwork    = GetNameOfContactUserIdInNetwork(contactOne.Id, contactTwo.GetBestEmailAddress().Address);
            var contactNotInNetwork = GetNameOfContactUserIdInNetwork(contactOne.Id, contactThree.GetBestEmailAddress().Address);

            Assert.AreEqual(contactTwo.FullName, contactInNetwork);
            Assert.AreEqual("", contactNotInNetwork);
        }
Ejemplo n.º 5
0
        public void TestSentRepresentativeInvitationToFriend()
        {
            var member  = _memberAccountsCommand.CreateTestMember(0);
            var invitee = _memberAccountsCommand.CreateTestMember(1);

            _networkingCommand.CreateFirstDegreeLink(member.Id, invitee.Id);

            var invitation = new RepresentativeInvitation {
                InviterId = member.Id, InviteeId = invitee.Id
            };

            _memberFriendsCommand.SendInvitation(invitation);

            LogIn(member);
            GetPage <Invitations>();
            AssertPageContains(invitee.FullName);
        }
Ejemplo n.º 6
0
        public void TestByNameWithFirstDegreeContact()
        {
            var member      = _memberAccountsCommand.CreateTestMember(0);
            var activated   = _memberAccountsCommand.CreateTestMember(EmailAddress1, FirstName, LastName1);
            var deactivated = _memberAccountsCommand.CreateTestMember(EmailAddress2, FirstName, LastName2);

            activated.VisibilitySettings.Personal.Set(PersonalContactDegree.FirstDegree, PersonalVisibility.Name);
            _memberAccountsCommand.UpdateMember(activated);

            deactivated.IsActivated = false;
            deactivated.VisibilitySettings.Personal.Set(PersonalContactDegree.FirstDegree, PersonalVisibility.Name);
            _memberAccountsCommand.UpdateMember(deactivated);

            // Create first degree contacts.

            _networkingCommand.CreateFirstDegreeLink(member.Id, activated.Id);
            _networkingCommand.CreateFirstDegreeLink(member.Id, deactivated.Id);

            TestByName(member.Id, activated.Id, deactivated.Id);
        }
Ejemplo n.º 7
0
        private void CreateFriend(Guid memberId, out Member friend, out Candidate candidate, out Resume resume)
        {
            friend    = _memberAccountsCommand.CreateTestMember(1);
            candidate = _candidatesCommand.GetCandidate(friend.Id);

            // Set values.

            candidate.Status = CandidateStatus.OpenToOffers;
            _locationQuery.ResolvePostalSuburb(friend.Address.Location, Australia, Suburb + " " + Postcode + " " + CountrySubdivision);

            friend.PhoneNumbers = new List <PhoneNumber>
            {
                new PhoneNumber {
                    Number = "123123123", Type = PhoneNumberType.Home
                },
                new PhoneNumber {
                    Number = "234234234", Type = PhoneNumberType.Mobile
                },
                new PhoneNumber {
                    Number = "345345345", Type = PhoneNumberType.Work
                },
            };
            friend.Gender = Gender.Male;

            friend.VisibilitySettings.Personal.FirstDegreeVisibility = PersonalVisibility.All;

            // Create a resume.

            _memberAccountsCommand.UpdateMember(friend);
            resume = CreateResume(candidate);

            // Save.

            _memberAccountsCommand.UpdateMember(friend);
            _candidatesCommand.UpdateCandidate(candidate);

            _networkingCommand.CreateFirstDegreeLink(memberId, friend.Id);
        }
Ejemplo n.º 8
0
        public void TestFriend()
        {
            var member = _membersCommand.CreateTestMember(0);
            var friend = _membersCommand.CreateTestMember(1);

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

            // Member views friend.

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

            AssertViews(member.Id, views, friend);

            // Friend views member.

            views = new PersonalViews(new PersonalView(member, PersonalContactDegree.FirstDegree, PersonalContactDegree.FirstDegree));
            AssertViews(friend.Id, views, member);
        }
Ejemplo n.º 9
0
        protected Member PreLoadTestUserProfiles(bool admin, bool createEmployer, bool link,
                                                 bool inviters, bool fullSetOfNetworkers, bool jobs, bool references, bool resumeRequests)
        {
            #region set up 10 networkers

            Member five = null;
            Member six  = null;

            Member member    = _memberAccountsCommand.CreateTestMember(TestNetworkerUserId, "password", "Homer", "Simpson");
            var    candidate = _candidatesCommand.GetCandidate(member.Id);
            _candidateResumesCommand.AddTestResume(candidate);

            Member two   = _memberAccountsCommand.CreateTestMember(TestUserTwoId, "password", "Two First", "Two Last");
            Member three = _memberAccountsCommand.CreateTestMember(TestUserThreeId, "password", "Three First", "Three Last");

            Member four = _memberAccountsCommand.CreateTestMember(TestUserFourId);

            if (fullSetOfNetworkers)
            {
                five = _memberAccountsCommand.CreateTestMember(TestUserFiveId);
                six  = _memberAccountsCommand.CreateTestMember(TestUserSixId);
                _memberAccountsCommand.CreateTestMember(TestUserSevenId);
                _memberAccountsCommand.CreateTestMember(TestUserEightId);
                _memberAccountsCommand.CreateTestMember(TestUserNineId);
            }

            #endregion
            #region set up an employer and a job ad
            if (createEmployer)
            {
                Employer employer = _employerAccountsCommand.CreateTestEmployer(TestEmployerUserId, _organisationsCommand.CreateTestOrganisation("LinkMe Pty Ltd"));

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

                var ja = employer.CreateTestJobAd("test job", "lol test job");
                _jobAdsCommand.PostJobAd(ja);
            }
            #endregion
            #region set up an administrator

            if (admin)
            {
                CreateAdministrator(TestAdministratorUserId);
            }

            #endregion
            #region link up some users

            if (link)
            {
                _networkingCommand.CreateFirstDegreeLink(member.Id, two.Id);
                _networkingCommand.CreateFirstDegreeLink(member.Id, three.Id);
                _networkingCommand.CreateFirstDegreeLink(member.Id, four.Id);
            }

            if (link && fullSetOfNetworkers)
            {
                _networkingCommand.CreateFirstDegreeLink(two.Id, five.Id);
                _networkingCommand.CreateFirstDegreeLink(two.Id, six.Id);
                _networkingCommand.CreateFirstDegreeLink(three.Id, six.Id);
            }

            #endregion
            return(member);
        }
Ejemplo n.º 10
0
        public void TestDisabledFriendsFriends()
        {
            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 });

            // Disable.

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

            // Add another link.

            _networkingCommand.CreateFirstDegreeLink(friends[1].Id, friendsFriend.Id);
            AssertFriendsFriends(
                member.Id,
                new Dictionary <Guid, Guid[]>
            {
                { friendsFriend.Id, new[] { friends[1].Id } }
            },
                new[] { friends[0].Id, friends[1].Id });
        }
Ejemplo n.º 11
0
        public void TestEmailProfileDetails()
        {
            var index = 0;

            // Create the inviter.

            var inviter = _memberAccountsCommand.CreateTestMember(0);

            inviter.VisibilitySettings.Personal.FirstDegreeVisibility = PersonalVisibility.All;
            _memberAccountsCommand.UpdateMember(inviter);

            // All access, no properties set.

            index++;
            var invitee = _memberAccountsCommand.CreateTestMember(index);

            var invitation = new FriendInvitation {
                InviterId = inviter.Id, InviteeId = invitee.Id, Text = MessageText, DonationRequestId = null
            };

            _networkingInvitationsCommand.CreateInvitation(invitation);

            var templateEmail = new FriendInvitationEmail(invitee, inviter, invitation, null, GetCurrentJobs(inviter.Id), 0);

            _emailsCommand.TrySend(templateEmail);

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(inviter, Return, invitee);
            email.AssertSubject(GetSubject());
            email.AssertHtmlViewChecks();
            AssertHtmlView(email, templateEmail, inviter, invitee, invitation, null);
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);

            // All access, 1 friend.

            index++;
            var friend = _memberAccountsCommand.CreateTestMember(index);

            _networkingCommand.CreateFirstDegreeLink(inviter.Id, friend.Id);

            index++;
            invitee = _memberAccountsCommand.CreateTestMember(index);

            invitation = new FriendInvitation {
                InviterId = inviter.Id, InviteeId = invitee.Id, Text = MessageText, DonationRequestId = null
            };
            _networkingInvitationsCommand.CreateInvitation(invitation);

            templateEmail = new FriendInvitationEmail(invitee, inviter, invitation, null, GetCurrentJobs(inviter.Id), 1);
            _emailsCommand.TrySend(templateEmail);

            email = _emailServer.AssertEmailSent();
            email.AssertAddresses(inviter, Return, invitee);
            email.AssertSubject(GetSubject());
            email.AssertHtmlViewChecks();
            AssertHtmlView(email, templateEmail, inviter, invitee, invitation, null);
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);

            // All access, 2 friends.

            index++;
            friend = _memberAccountsCommand.CreateTestMember(index);
            _networkingCommand.CreateFirstDegreeLink(inviter.Id, friend.Id);

            index++;
            invitee = _memberAccountsCommand.CreateTestMember(index);

            invitation = new FriendInvitation {
                InviterId = inviter.Id, InviteeId = invitee.Id, Text = MessageText, DonationRequestId = null
            };
            _networkingInvitationsCommand.CreateInvitation(invitation);

            templateEmail = new FriendInvitationEmail(invitee, inviter, invitation, null, GetCurrentJobs(inviter.Id), 2);
            _emailsCommand.TrySend(templateEmail);

            email = _emailServer.AssertEmailSent();
            email.AssertAddresses(inviter, Return, invitee);
            email.AssertSubject(GetSubject());
            email.AssertHtmlViewChecks();
            AssertHtmlView(email, templateEmail, inviter, invitee, invitation, null);
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);

            // No access, 2 friends.

            inviter.VisibilitySettings.Personal.FirstDegreeVisibility &= ~PersonalVisibility.FriendsList;
            _memberAccountsCommand.UpdateMember(inviter);

            index++;
            invitee = _memberAccountsCommand.CreateTestMember(index);

            invitation = new FriendInvitation {
                InviterId = inviter.Id, InviteeId = invitee.Id, Text = MessageText, DonationRequestId = null
            };
            _networkingInvitationsCommand.CreateInvitation(invitation);

            templateEmail = new FriendInvitationEmail(invitee, inviter, invitation, null, GetCurrentJobs(inviter.Id), 0);
            _emailsCommand.TrySend(templateEmail);

            email = _emailServer.AssertEmailSent();
            email.AssertAddresses(inviter, Return, invitee);
            email.AssertSubject(GetSubject());
            email.AssertHtmlViewChecks();
            AssertHtmlView(email, templateEmail, inviter, invitee, invitation, null);
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);

            // All access, current jobs set.

            inviter.VisibilitySettings.Personal.FirstDegreeVisibility |= PersonalVisibility.FriendsList;
            _memberAccountsCommand.UpdateMember(inviter);

            var candidate = _candidatesCommand.GetCandidate(inviter.Id);

            _candidateResumesCommand.AddTestResume(candidate);

            index++;
            invitee = _memberAccountsCommand.CreateTestMember(index);

            invitation = new FriendInvitation {
                InviterId = inviter.Id, InviteeId = invitee.Id, Text = MessageText, DonationRequestId = null
            };
            _networkingInvitationsCommand.CreateInvitation(invitation);

            templateEmail = new FriendInvitationEmail(invitee, inviter, invitation, null, GetCurrentJobs(inviter.Id), 2);
            _emailsCommand.TrySend(templateEmail);

            email = _emailServer.AssertEmailSent();
            email.AssertAddresses(inviter, Return, invitee);
            email.AssertSubject(GetSubject());
            email.AssertHtmlViewChecks();
            AssertHtmlView(email, templateEmail, inviter, invitee, invitation, null);
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);

            // No access, current jobs set.

            inviter.VisibilitySettings.Personal.FirstDegreeVisibility &= ~PersonalVisibility.CurrentJobs;
            _memberAccountsCommand.UpdateMember(inviter);

            index++;
            invitee = _memberAccountsCommand.CreateTestMember(index);

            invitation = new FriendInvitation {
                InviterId = inviter.Id, InviteeId = invitee.Id, Text = MessageText, DonationRequestId = null
            };
            _networkingInvitationsCommand.CreateInvitation(invitation);

            templateEmail = new FriendInvitationEmail(invitee, inviter, invitation, null, null, 2);
            _emailsCommand.TrySend(templateEmail);

            email = _emailServer.AssertEmailSent();
            email.AssertAddresses(inviter, Return, invitee);
            email.AssertSubject(GetSubject());
            email.AssertHtmlViewChecks();
            AssertHtmlView(email, templateEmail, inviter, invitee, invitation, null);
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);
        }