Beispiel #1
0
        public void TestMultipleDeactivatedFriends()
        {
            // Create the member.

            var member = CreateMember(0);

            // Create activated and deactivated friends.

            const PersonalVisibility access = PersonalVisibility.Name | PersonalVisibility.CurrentJobs | PersonalVisibility.CandidateStatus | PersonalVisibility.Suburb | PersonalVisibility.CountrySubdivision | PersonalVisibility.Interests;

            IList <Member>    activatedFriends;
            IList <Candidate> activatedCandidates;
            IList <Resume>    activatedResumes;

            CreateFriends(member.Id, access, 1, 2, out activatedFriends, out activatedCandidates, out activatedResumes);

            IList <Member>    deactivatedFriends;
            IList <Candidate> deactivatedCandidates;
            IList <Resume>    deactivatedResumes;

            CreateFriends(member.Id, access, 3, 2, out deactivatedFriends, out deactivatedCandidates, out deactivatedResumes);

            deactivatedFriends[0].IsActivated = false;
            _memberAccountsCommand.UpdateMember(deactivatedFriends[0]);
            deactivatedFriends[1].IsActivated = false;
            _memberAccountsCommand.UpdateMember(deactivatedFriends[1]);

            // Log in.

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

            AssertFriends(activatedFriends, activatedCandidates, activatedResumes, false);
            AssertFriendsNotVisible(deactivatedFriends, deactivatedResumes);
        }
Beispiel #2
0
        public void TestCandidateStatus()
        {
            // Create the member and friends.

            var member = CreateMember(0);
            const PersonalVisibility access = PersonalVisibility.All;
            IList <Member>           friends;
            IList <Candidate>        candidates;
            IList <Resume>           resumes;

            CreateFriends(member.Id, access, 1, 4, out friends, out candidates, out resumes);

            candidates[0].Status = CandidateStatus.ActivelyLooking;
            _candidatesCommand.UpdateCandidate(candidates[0]);
            candidates[1].Status = CandidateStatus.NotLooking;
            _candidatesCommand.UpdateCandidate(candidates[1]);
            candidates[2].Status = CandidateStatus.OpenToOffers;
            _candidatesCommand.UpdateCandidate(candidates[2]);
            candidates[3].Status = CandidateStatus.Unspecified;
            _candidatesCommand.UpdateCandidate(candidates[3]);

            // Log in.

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

            AssertFriends(friends, candidates, resumes);
        }
Beispiel #3
0
        private void ResetFlag(PersonalContactDegree degree, PersonalVisibility flag)
        {
            switch (degree)
            {
            case PersonalContactDegree.Self:
                break;

            case PersonalContactDegree.FirstDegree:
                _firstDegreeVisibility = _firstDegreeVisibility.ResetFlag(flag);
                break;

            case PersonalContactDegree.SecondDegree:
                _secondDegreeVisibility = _secondDegreeVisibility.ResetFlag(flag);
                break;

            case PersonalContactDegree.Public:
                _publicVisibility = _publicVisibility.ResetFlag(flag);
                return;

            default:
                return;
            }

            ResetFlag(degree + 1, flag);
        }
Beispiel #4
0
        public void Set(PersonalContactDegree degree, PersonalVisibility flag)
        {
            // Make sure the flag is set for all lower degrees.

            SetFlag(degree, flag);

            // Make sure it is not set for all higher degrees.

            if (degree < PersonalContactDegree.Public)
            {
                ResetFlag(degree + 1, flag);
            }
        }
Beispiel #5
0
        public void TestSetAllFlagsFirstDegree()
        {
            const PersonalVisibility flag = PersonalVisibility.All;

            var member = new Member {
                VisibilitySettings = new VisibilitySettings()
            };

            member.VisibilitySettings.Personal.Set(PersonalContactDegree.FirstDegree, flag);

            Assert.IsFalse(member.VisibilitySettings.Personal.PublicVisibility.IsFlagSet(flag));
            Assert.IsFalse(member.VisibilitySettings.Personal.SecondDegreeVisibility.IsFlagSet(flag));
            Assert.IsTrue(member.VisibilitySettings.Personal.FirstDegreeVisibility.IsFlagSet(flag));
        }
Beispiel #6
0
        public void TestSetOneFlagHidden()
        {
            const PersonalVisibility flag = PersonalVisibility.Photo;

            var member = new Member {
                VisibilitySettings = new VisibilitySettings()
            };

            member.VisibilitySettings.Personal.Set(PersonalContactDegree.Self, flag);

            Assert.IsFalse(member.VisibilitySettings.Personal.PublicVisibility.IsFlagSet(flag));
            Assert.IsFalse(member.VisibilitySettings.Personal.SecondDegreeVisibility.IsFlagSet(flag));
            Assert.IsFalse(member.VisibilitySettings.Personal.FirstDegreeVisibility.IsFlagSet(flag));
        }
Beispiel #7
0
        public void TestViewFriendsLink()
        {
            var member = CreateMember(0);
            const PersonalVisibility access = PersonalVisibility.Name | PersonalVisibility.SendMessages | PersonalVisibility.FriendsList | PersonalVisibility.SendInvites;
            IList <Member>           friends;
            IList <Candidate>        candidates;
            IList <Resume>           resumes;

            CreateFriends(member.Id, access, 1, 1, out friends, out candidates, out resumes);

            // Log in.

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

            FollowViewFriendsLink(friends, 0);
        }
Beispiel #8
0
        public void TestInterestsNotVisible()
        {
            // Create the member and friends.

            var member = CreateMember(0);
            const PersonalVisibility access = PersonalVisibility.Name | PersonalVisibility.CurrentJobs | PersonalVisibility.CandidateStatus | PersonalVisibility.Suburb | PersonalVisibility.CountrySubdivision;
            IList <Member>           friends;
            IList <Candidate>        candidates;
            IList <Resume>           resumes;

            CreateFriends(member.Id, access, 1, 1, out friends, out candidates, out resumes);

            // Log in.

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

            AssertFriends(friends, candidates, resumes);
        }
Beispiel #9
0
        public void TestDisplay()
        {
            // 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);

            // Log in.

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

            AssertFriends(friends, candidates, resumes);
            AssertPageDoesNotContain("Represented by me");
            AssertPageDoesNotContain("My nominated representative");
        }
Beispiel #10
0
        private void CreateFriends(Guid memberId, PersonalVisibility firstDegree, int start, int count, out IList <Member> friends, out IList <Candidate> candidates, out IList <Resume> resumes)
        {
            friends    = new List <Member>();
            candidates = new List <Candidate>();
            resumes    = new List <Resume>();

            for (var index = start; index < start + count; index++)
            {
                var friend    = _memberAccountsCommand.CreateTestMember(index);
                var candidate = _candidatesCommand.GetCandidate(friend.Id);

                // Set values.

                candidate.Status = CandidateStatus.OpenToOffers;

                var resume = new Resume
                {
                    Jobs = new List <Job> {
                        new Job {
                            Dates = new PartialDateRange(PartialDate.Parse("01/01/1970")), Title = string.Format(CurrentJobsTemplate, index)
                        }
                    }
                };

                _locationQuery.ResolvePostalSuburb(friend.Address.Location, Australia, Suburb + " " + Postcode + " " + CountrySubdivision);
                friend.VisibilitySettings.Personal.FirstDegreeVisibility = firstDegree;

                // Save.

                _memberAccountsCommand.UpdateMember(friend);
                _candidatesCommand.UpdateCandidate(candidate);
                _candidateResumesCommand.CreateResume(candidate, resume);

                friends.Add(friend);
                candidates.Add(candidate);
                resumes.Add(resume);

                _networkingCommand.CreateFirstDegreeLink(memberId, friend.Id);
            }
        }
Beispiel #11
0
        public void TestDeactivatedFriend()
        {
            // 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);

            friends[0].IsActivated = false;
            _memberAccountsCommand.UpdateMember(friends[0]);

            // Log in.

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

            AssertFriendsNotVisible(friends, resumes);
        }
Beispiel #12
0
        public void TestRepresenteeNameNotVisible()
        {
            // Create the member and friends.

            var member = CreateMember(0);
            const PersonalVisibility access = 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(friends[0].Id, member.Id);

            // Log in.

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

            // Because they are a representee then they show up in the list even though their name is not visible.

            AssertFriends(friends, candidates, resumes);
            AssertPageContains("Represented by me");
            AssertPageDoesNotContain("My nominated representative");
        }
Beispiel #13
0
        internal static bool CanAccess(PersonalContactDegree contactDegree, PersonalVisibilitySettings visibilitySettings, PersonalVisibility visibility)
        {
            var contactVisibility = visibilitySettings == null?GetAnonymousVisibility(contactDegree) : GetVisibility(contactDegree, visibilitySettings);

            return(contactVisibility.IsFlagSet(visibility));
        }
Beispiel #14
0
 private static bool AccessFlagSet(PersonalVisibility flag, PersonalVisibility currentAccess)
 {
     return(currentAccess.IsFlagSet(flag));
 }
Beispiel #15
0
 IList <Guid> IMemberContactsQuery.GetFirstDegreeContacts(Guid fromId, PersonalVisibility visibility)
 {
     return(_repository.GetFirstDegreeContacts(fromId, visibility));
 }
        private static void SetPlaceHolderVisibility(Control placeHolder, PersonalView viewer, PersonalVisibility visibility)
        {
            if (placeHolder == null)
            {
                throw new ArgumentNullException("placeHolder");
            }

            placeHolder.Visible = viewer.CanAccess(visibility);
        }
Beispiel #17
0
 public bool CanAccess(PersonalVisibility visibility)
 {
     return(CanAccess(_effectiveContactDegree, _member.VisibilitySettings.Personal, visibility));
 }