Exemplo n.º 1
0
        private Candidate CreateCandidateWithResumeFile()
        {
            // Create member.

            var member = _membersCommand.CreateTestMember(0);

            member.CreatedTime = DateTime.Now.AddDays(-10);
            _membersCommand.UpdateMember(member);

            // Create candidate.

            var candidate = new Candidate {
                Id = member.Id
            };

            _candidatesCommand.CreateCandidate(candidate);

            // Create resume file.

            var fileReference = GetResumeFile();
            var resume        = new Resume {
                Citizenship = "Something"
            };

            _candidateResumesCommand.CreateResume(candidate, resume, fileReference);

            return(candidate);
        }
Exemplo n.º 2
0
        public void TestEnabled()
        {
            var member = _membersCommand.CreateTestMember(0);

            _userAccountsCommand.EnableUserAccount(member, Guid.NewGuid());
            _userAccountsCommand.ActivateUserAccount(member, Guid.NewGuid());

            member = _membersQuery.GetMember(member.Id);
            Assert.IsTrue(member.IsEnabled);
            Assert.IsTrue(member.IsActivated);
            Assert.IsTrue(_userAccountsQuery.IsEnabled(member.Id));
            Assert.IsTrue(_userAccountsQuery.IsActive(member.Id));

            // Disable.

            _userAccountsCommand.DisableUserAccount(member, Guid.NewGuid());

            member = _membersQuery.GetMember(member.Id);
            Assert.IsFalse(member.IsEnabled);
            Assert.IsTrue(member.IsActivated);
            Assert.IsFalse(_userAccountsQuery.IsEnabled(member.Id));
            Assert.IsFalse(_userAccountsQuery.IsActive(member.Id));

            // Enable.

            _userAccountsCommand.EnableUserAccount(member, Guid.NewGuid());

            member = _membersQuery.GetMember(member.Id);
            Assert.IsTrue(member.IsEnabled);
            Assert.IsTrue(member.IsActivated);
            Assert.IsTrue(_userAccountsQuery.IsEnabled(member.Id));
            Assert.IsTrue(_userAccountsQuery.IsActive(member.Id));
        }
Exemplo n.º 3
0
        public void TestConvertResumeToRtf()
        {
            var employer = _employersCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));
            var member1  = _membersCommand.CreateTestMember(1);
            var member2  = _membersCommand.CreateTestMember(2);

            var candidate1 = new Candidate {
                Id = member1.Id
            };

            _candidatesCommand.CreateCandidate(candidate1);
            var candidate2 = new Candidate {
                Id = member2.Id
            };

            _candidatesCommand.CreateCandidate(candidate2);

            var resume1 = _candidateResumesCommand.AddTestResume(candidate1);
            var resume2 = _candidateResumesCommand.AddTestResume(candidate2);

            var resumeFile1 = _resumeFilesQuery.GetResumeFile(employer, member1, candidate1, resume1);
            var resumeFile2 = _resumeFilesQuery.GetResumeFile(employer, member2, candidate2, resume2);

            Assert.IsTrue(resumeFile1.Contents.Length > 1000);
            Assert.IsTrue(resumeFile2.Contents.Length > 1000);
        }
Exemplo n.º 4
0
        public void TestMemberViewsWithLinkMe()
        {
            // It used to be the case that we filtered out LinkMe employers from these reports but given the
            // changes in the company etc we will include them from now on because it makes things a whole lot
            // easier, and stats from LinkMe should not be significant now.

            var organisation = _organisationsCommand.CreateTestVerifiedOrganisation("LinkMe");
            var employer1    = _employersCommand.CreateTestEmployer(0, organisation);

            var employer2 = _employersCommand.CreateTestEmployer(2, _organisationsCommand.CreateTestOrganisation(2));
            var member1   = _membersCommand.CreateTestMember(1);
            var member2   = _membersCommand.CreateTestMember(2);
            var member3   = _membersCommand.CreateTestMember(3);

            // Make some viewings.

            var channel = _channelsQuery.GetChannel("Web");
            var app     = _channelsQuery.GetChannelApp(channel.Id, "Web");

            _employerMemberViewsCommand.ViewMember(app, employer1, member1);
            Assert.AreEqual(1, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member1);
            Assert.AreEqual(2, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer1, member2);
            Assert.AreEqual(3, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member3);
            Assert.AreEqual(4, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);
        }
Exemplo n.º 5
0
        public void TestGetMemberViews()
        {
            var channel = _channelsQuery.GetChannel("Web");
            var app     = _channelsQuery.GetChannelApp(channel.Id, "Web");

            Assert.AreEqual(0, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            // Make some viewings.

            var employer1 = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1));
            var employer2 = _employersCommand.CreateTestEmployer(2, _organisationsCommand.CreateTestOrganisation(2));
            var member1   = _membersCommand.CreateTestMember(1);
            var member2   = _membersCommand.CreateTestMember(2);
            var member3   = _membersCommand.CreateTestMember(3);

            _employerMemberViewsCommand.ViewMember(app, employer1, member1);
            Assert.AreEqual(1, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer1, member2);
            Assert.AreEqual(2, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member1);
            Assert.AreEqual(3, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member3);
            Assert.AreEqual(4, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);
        }
Exemplo n.º 6
0
        public void TestNote()
        {
            var employer = CreateEmployer(0);
            var jobAd    = _jobAdsCommand.PostTestJobAd(employer);

            var noteCreator = _membersCommand.CreateTestMember(1);

            // Add one.

            var note = CreateNote(1, noteCreator, jobAd.Id);

            AssertNotes(noteCreator, jobAd.Id, new[] { note }, new MemberJobAdNote[0]);
            AssertHasNotes(noteCreator, jobAd.Id);
        }
Exemplo n.º 7
0
        private Member CreateMember(int index, bool isResumeVisible, bool isPhoneNumberVisible, bool hasPhoneNumbers)
        {
            var member = _membersCommand.CreateTestMember(index);

            if (hasPhoneNumbers)
            {
                member.PhoneNumbers = new List <PhoneNumber>
                {
                    new PhoneNumber {
                        Number = string.Format(MobilePhoneNumberFormat, index), Type = PhoneNumberType.Mobile
                    },
                    new PhoneNumber {
                        Number = string.Format(HomePhoneNumberFormat, index), Type = PhoneNumberType.Home
                    },
                    new PhoneNumber {
                        Number = string.Format(WorkPhoneNumberFormat, index), Type = PhoneNumberType.Work
                    }
                };
            }
            else
            {
                member.PhoneNumbers = null;
            }

            member.VisibilitySettings.Professional.EmploymentVisibility = isResumeVisible
                ? member.VisibilitySettings.Professional.EmploymentVisibility.SetFlag(ProfessionalVisibility.Resume)
                : member.VisibilitySettings.Professional.EmploymentVisibility.ResetFlag(ProfessionalVisibility.Resume);

            member.VisibilitySettings.Professional.EmploymentVisibility = isPhoneNumberVisible
                ? member.VisibilitySettings.Professional.EmploymentVisibility.SetFlag(ProfessionalVisibility.PhoneNumbers)
                : member.VisibilitySettings.Professional.EmploymentVisibility.ResetFlag(ProfessionalVisibility.PhoneNumbers);

            _membersCommand.UpdateMember(member);
            return(member);
        }
Exemplo n.º 8
0
        private IMember CreateMember()
        {
            var member = _membersCommand.CreateTestMember(0);

            member.Address.Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry(Country), Location);
            _membersCommand.UpdateMember(member);

            var candidate = new Candidate {
                Id = member.Id
            };

            _candidatesCommand.CreateCandidate(candidate);

            // Give them a resume.

            var resume = new Resume
            {
                Jobs = new List <Job>
                {
                    new Job {
                        Title = JobTitle
                    }
                }
            };

            _candidateResumesCommand.CreateResume(candidate, resume);
            return(member);
        }
Exemplo n.º 9
0
        public void TestEmailAddress()
        {
            var member = _membersCommand.CreateTestMember(0);

            Assert.IsTrue(member.EmailAddresses[0].IsVerified);
            AssertBestEmailAddress(member.EmailAddresses[0].Address, true, member);

            // Unverify the address.

            _emailVerificationsCommand.UnverifyEmailAddress(member.EmailAddresses[0].Address, null);

            // Assert.

            member = _membersQuery.GetMember(member.Id);
            Assert.IsFalse(member.EmailAddresses[0].IsVerified);
            AssertBestEmailAddress(member.EmailAddresses[0].Address, false, member);
        }
Exemplo n.º 10
0
        public void TestFilterFlagListId()
        {
            var employer = CreateEmployer(0);
            var jobAd1   = _jobAdsCommand.PostTestJobAd(employer);
            var jobAd2   = _jobAdsCommand.PostTestJobAd(employer);
            var member   = _membersCommand.CreateTestMember(1);

            // jobAd1 in folder.

            var flagList = _jobAdFlagListsQuery.GetFlagList(member);

            _memberJobAdListsCommand.AddJobAdToFlagList(member, flagList, jobAd1.Id);

            // Filter.

            TestFlaggedFilter(new[] { jobAd1.Id }, member, new[] { jobAd1.Id, jobAd2.Id });
        }
Exemplo n.º 11
0
        public void TestGetEmailVerificationById()
        {
            var member = _membersCommand.CreateTestMember(1);

            // Create.

            var expectedEmailVerification = new EmailVerification {
                EmailAddress = member.GetBestEmailAddress().Address, UserId = member.Id
            };

            _emailVerificationsCommand.CreateEmailVerification(expectedEmailVerification);

            // Get.

            var emailVerification = _emailVerificationsQuery.GetEmailVerification(member.Id, member.GetBestEmailAddress().Address);

            AssertAreEqual(expectedEmailVerification, emailVerification);
        }
        private Member CreateMember(int index)
        {
            var member = _membersCommand.CreateTestMember(index);

            _candidatesCommand.CreateCandidate(new Candidate {
                Id = member.Id
            });
            return(member);
        }
Exemplo n.º 13
0
        protected Member CreateMember()
        {
            var member    = _membersCommand.CreateTestMember(0);
            var candidate = new Candidate {
                Id = member.Id
            };

            _candidatesCommand.CreateCandidate(candidate);
            return(member);
        }
Exemplo n.º 14
0
        private Member CreateMember(int index, bool isResumeVisible, bool hasResume)
        {
            var member = _membersCommand.CreateTestMember(index);

            var candidate = new Candidate {
                Id = member.Id
            };

            _candidatesCommand.CreateCandidate(candidate);
            if (hasResume)
            {
                _candidateResumesCommand.AddTestResume(candidate);
            }

            member.VisibilitySettings.Professional.EmploymentVisibility = isResumeVisible
                ? member.VisibilitySettings.Professional.EmploymentVisibility.SetFlag(ProfessionalVisibility.Resume)
                : member.VisibilitySettings.Professional.EmploymentVisibility.ResetFlag(ProfessionalVisibility.Resume);

            _membersCommand.UpdateMember(member);
            return(member);
        }
Exemplo n.º 15
0
        public void TestFriendDailyLimit()
        {
            var member = _membersCommand.CreateTestMember(0);

            // Create 10 invitations.

            const int count = 10;

            for (var index = 1; index <= count; ++index)
            {
                var friend = _membersCommand.CreateTestMember(index);
                _memberFriendsCommand.SendInvitation(new FriendInvitation {
                    InviterId = member.Id, InviteeId = friend.Id
                });
            }

            // Try to send one more.

            var nextFriend = _membersCommand.CreateTestMember(count + 1);

            _memberFriendsCommand.SendInvitation(new FriendInvitation {
                InviterId = member.Id, InviteeId = nextFriend.Id
            });
        }
Exemplo n.º 16
0
        private Member CreateMember()
        {
            var member    = _membersCommand.CreateTestMember(0);
            var candidate = new Candidate {
                Id = member.Id
            };

            _candidatesCommand.CreateCandidate(candidate);

            const string  fileName = "resume.doc";
            var           data     = TestResume.Complete.GetData();
            FileReference fileReference;

            using (var stream = new MemoryStream(data))
            {
                fileReference = _filesCommand.SaveFile(FileType.Resume, new StreamFileContents(stream), fileName);
            }

            var resume = _parseResumesCommand.ParseResume(fileReference).Resume;

            _candidateResumesCommand.CreateResume(candidate, resume);
            return(member);
        }
Exemplo n.º 17
0
 public static Member CreateTestMember(this IMembersCommand membersCommand, string emailAddress, string firstName, string lastName)
 {
     return(membersCommand.CreateTestMember(emailAddress, firstName, lastName, null));
 }
Exemplo n.º 18
0
 public static Member CreateTestMember(this IMembersCommand membersCommand, string emailAddress)
 {
     return(membersCommand.CreateTestMember(emailAddress, string.Format(FirstNameFormat, 0), string.Format(LastNameFormat, 0)));
 }
Exemplo n.º 19
0
 public static Member CreateTestMember(this IMembersCommand membersCommand, int index, DateTime createTime)
 {
     return(membersCommand.CreateTestMember(string.Format(EmailAddressFormat, index), string.Format(FirstNameFormat, index), string.Format(LastNameFormat, index), createTime));
 }
Exemplo n.º 20
0
        public void TestByName()
        {
            var member      = _memberAccountsCommand.CreateTestMember(0);
            var activated   = _memberAccountsCommand.CreateTestMember(EmailAddress1, FirstName, LastName1);
            var deactivated = _memberAccountsCommand.CreateTestMember(EmailAddress2, FirstName, LastName2);

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

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

            TestByName(member.Id, activated.Id, deactivated.Id);
        }
Exemplo n.º 21
0
        public void TestSelf()
        {
            var member = _membersCommand.CreateTestMember(1);

            var views = new PersonalViews(new PersonalView(member, PersonalContactDegree.Self, PersonalContactDegree.Self));

            AssertViews(member.Id, views, member);
        }
Exemplo n.º 22
0
        public void TestNoReferral()
        {
            var member = _membersCommand.CreateTestMember(0);

            Assert.IsNull(_referralsQuery.GetExternalReferral(member.Id));
        }
Exemplo n.º 23
0
 protected Member CreateMember(int index)
 {
     return _membersCommand.CreateTestMember(index);
 }
Exemplo n.º 24
0
        public void TestNoFriends()
        {
            var member = _membersCommand.CreateTestMember(0);

            Assert.AreEqual(0, _memberContactsQuery.GetFirstDegreeContacts(member.Id).Count);
        }
Exemplo n.º 25
0
        public void TestOrganisationSharedNotes()
        {
            var member      = _membersCommand.CreateTestMember(1);
            var noteCreator = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1));

            var organisation = noteCreator.Organisation;
            var noteReader   = _employersCommand.CreateTestEmployer(2, organisation);

            // Create a private and a shared.

            var note1 = CreateNote(1, noteCreator, member.Id, false);

            NoteCreationDelay();
            var note2 = CreateNote(2, noteCreator, member.Id, true);

            AssertNotes(noteCreator, member.Id, new[] { note2, note1 }, new CandidateNote[0]);
            AssertNotes(noteReader, member.Id, new[] { note2 }, new[] { note1 });
            AssertHasNotes(noteCreator, member.Id);
            AssertHasNotes(noteReader, member.Id);

            // The creator leaves the company, so they cannot access their own shared notes.

            var otherOrganisation = new Organisation {
                Name = "OtherOrganisation"
            };

            _organisationsCommand.CreateOrganisation(otherOrganisation);

            noteCreator.Organisation = otherOrganisation;
            _employersCommand.UpdateEmployer(noteCreator);

            AssertNotes(noteCreator, member.Id, new[] { note1 }, new[] { note2 });
            AssertNotes(noteReader, member.Id, new[] { note2 }, new[] { note1 });
            AssertHasNotes(noteCreator, member.Id);
            AssertHasNotes(noteReader, member.Id);

            // Create a private while not part of the company.

            var note3 = CreateNote(3, noteCreator, member.Id, false);

            AssertNotes(noteCreator, member.Id, new[] { note3, note1 }, new[] { note2 });
            AssertNotes(noteReader, member.Id, new[] { note2 }, new[] { note3, note1 });
            AssertHasNotes(noteCreator, member.Id);
            AssertHasNotes(noteReader, member.Id);

            // Join again so can see original notes.

            noteCreator.Organisation = organisation;
            _employersCommand.UpdateEmployer(noteCreator);

            AssertNotes(noteCreator, member.Id, new[] { note3, note2, note1 }, new CandidateNote[0]);
            AssertNotes(noteReader, member.Id, new[] { note2 }, new[] { note3, note1 });
            AssertHasNotes(noteCreator, member.Id);
            AssertHasNotes(noteReader, member.Id);

            // Change the latest to shared, so now the second employer can see it.

            _candidateNotesCommand.ShareNote(noteCreator, note3);

            AssertNotes(noteCreator, member.Id, new[] { note3, note2, note1 }, new CandidateNote[0]);
            AssertNotes(noteReader, member.Id, new[] { note3, note2 }, new[] { note1 });
            AssertHasNotes(noteCreator, member.Id);
            AssertHasNotes(noteReader, member.Id);

            // Make that one private once again.

            _candidateNotesCommand.UnshareNote(noteCreator, note3);

            AssertNotes(noteCreator, member.Id, new[] { note3, note2, note1 }, new CandidateNote[0]);
            AssertNotes(noteReader, member.Id, new[] { note2 }, new[] { note3, note1 });
            AssertHasNotes(noteCreator, member.Id);
            AssertHasNotes(noteReader, member.Id);
        }
Exemplo n.º 26
0
 private Member CreateMember(int index)
 {
     return(_membersCommand.CreateTestMember(index));
 }
Exemplo n.º 27
0
 public void TestCreateDuplicates()
 {
     _membersCommand.CreateTestMember(EmailAddress);
     _membersCommand.CreateTestMember(EmailAddress);
 }