コード例 #1
0
ファイル: ViewFriendsTests.cs プロジェクト: formist/LinkMe
        private void AssertFriend(Member friend, ICandidate candidate, IResume resume)
        {
            AssertPageContains(friend.FullName);

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

            // Current Jobs.

            if (viewer.CanAccess(PersonalVisibility.CurrentJobs))
            {
                AssertPageContains(resume.GetCurrentJobsDisplayHtml());
            }
            else
            {
                AssertPageDoesNotContain(resume.GetCurrentJobsDisplayHtml());
            }

            // Candidate Status.

            if (viewer.CanAccess(PersonalVisibility.CandidateStatus))
            {
                if (candidate.Status != CandidateStatus.Unspecified)
                {
                    AssertPageContains(NetworkerFacade.GetCandidateStatusText(candidate.Status));
                }
            }
            else
            {
                if (candidate.Status != CandidateStatus.Unspecified)
                {
                    AssertPageDoesNotContain(NetworkerFacade.GetCandidateStatusText(candidate.Status));
                }
            }

            // Suburb.

            if (viewer.CanAccess(PersonalVisibility.Suburb))
            {
                AssertPageContains(friend.Address.Location.Suburb);
                AssertPageContains(" " + friend.Address.Location.Postcode);
            }
            else
            {
                AssertPageDoesNotContain(friend.Address.Location.Suburb);
                AssertPageDoesNotContain(" " + friend.Address.Location.Postcode); // GUIDs can contain "3143", too!
            }

            // CountrySubdivision.

            if (viewer.CanAccess(PersonalVisibility.CountrySubdivision))
            {
                AssertPageContains(friend.Address.Location.CountrySubdivision.ShortName);
            }
            else
            {
                AssertPageDoesNotContain(friend.Address.Location.CountrySubdivision.ShortName);
            }
        }
コード例 #2
0
        private void AssertFriendsFriendNotVisible(ICommunicationRecipient friendsFriend, IResume friendsResume)
        {
            AssertPageDoesNotContain(friendsFriend.FullName);

            // Current Jobs.

            AssertPageDoesNotContain(friendsResume.GetCurrentJobsDisplayHtml());
        }
コード例 #3
0
        private bool AssertFriendsFriend(Guid memberId, Member friendsFriend, ICandidate friendsCandidate, IResume friendsResume, bool checkAddress)
        {
            try
            {
                AssertPageContains(friendsFriend.FullName);

                var contactDegree = friendsFriend.Id == memberId ? PersonalContactDegree.Self : PersonalContactDegree.SecondDegree;
                var view          = new PersonalView(friendsFriend, contactDegree, contactDegree);

                // Current Jobs.

                if (view.CanAccess(PersonalVisibility.CurrentJobs))
                {
                    var currentJobs = friendsResume.GetCurrentJobsDisplayHtml();
                    if (!string.IsNullOrEmpty(currentJobs))
                    {
                        AssertPageContains(currentJobs);
                    }
                }
                else
                {
                    var currentJobs = friendsResume.GetCurrentJobsDisplayHtml();
                    if (!string.IsNullOrEmpty(currentJobs))
                    {
                        AssertPageDoesNotContain(friendsResume.GetCurrentJobsDisplayHtml());
                    }
                }

                // Candidate Status.

                if (view.CanAccess(PersonalVisibility.CandidateStatus))
                {
                    if (friendsCandidate.Status != CandidateStatus.Unspecified)
                    {
                        AssertPageContains(NetworkerFacade.GetCandidateStatusText(friendsCandidate.Status));
                    }
                }
                else
                {
                    if (friendsCandidate.Status != CandidateStatus.Unspecified)
                    {
                        AssertPageDoesNotContain(NetworkerFacade.GetCandidateStatusText(friendsCandidate.Status));
                    }
                }

                // Suburb.

                if (checkAddress)
                {
                    if (view.CanAccess(PersonalVisibility.Suburb))
                    {
                        AssertPageContains(friendsFriend.Address.Location.Suburb);
                        AssertPageContains(" " + friendsFriend.Address.Location.Postcode);
                    }
                    else
                    {
                        AssertPageDoesNotContain(friendsFriend.Address.Location.Suburb);
                        AssertPageDoesNotContain(" " + friendsFriend.Address.Location.Postcode);
                    }

                    // CountrySubdivision.

                    if (view.CanAccess(PersonalVisibility.CountrySubdivision))
                    {
                        AssertPageContains(friendsFriend.Address.Location.CountrySubdivision.ShortName);
                    }
                    else
                    {
                        AssertPageDoesNotContain(friendsFriend.Address.Location.CountrySubdivision.ShortName);
                    }
                }

                return(true);
            }
            catch (AssertFailedException)
            {
                return(false);
            }
        }