public void TestFullName() { var member = CreateMember(false, true, true); var employer = CreateEmployer(); _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), MemberAccessReason.PhoneNumberViewed); LogIn(employer); TestTitle(member.FullName); }
public void TestDailyLimit() { var employer = CreateEmployer(); // Access up to the daily limit. Member member; Tuple <int, int> counts; for (var index = 0; index < DailyLimit; ++index) { member = CreateMember(index); // Check the counts. counts = _repository.GetMemberAccessCounts(employer.Id, member.Id, new[] { GetAccessReason() }); Assert.AreEqual(index, counts.Item1); Assert.AreEqual(index, counts.Item2); _employerMemberViewsCommand.CheckCanAccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), GetAccessReason()); _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), GetAccessReason()); } // Go one more. member = CreateMember(DailyLimit); counts = _repository.GetMemberAccessCounts(employer.Id, member.Id, new[] { GetAccessReason() }); Assert.AreEqual(DailyLimit, counts.Item1); Assert.AreEqual(DailyLimit, counts.Item2); try { _employerMemberViewsCommand.CheckCanAccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), GetAccessReason()); Assert.Fail(); } catch (TooManyAccessesException) { } try { _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), GetAccessReason()); Assert.Fail(); } catch (TooManyAccessesException) { } }
private ActionResult AccessMember(Guid candidateId, MemberAccessReason reason) { try { var employer = CurrentEmployer; var view = _employerMemberViewsQuery.GetEmployerMemberView(employer, candidateId); if (view == null) { return(JsonNotFound("candidate", JsonRequestBehavior.AllowGet)); } // Access the member. _employerMemberViewsCommand.AccessMember(ActivityContext.Channel.App, employer, view, reason); // Accessing will change what the employer can see so get the view again. view = _employerMemberViewsQuery.GetEmployerMemberView(employer, candidateId); return(Json(new CandidateResponseModel { Candidate = GetCandidateModel(view) }, JsonRequestBehavior.AllowGet)); } catch (UserException ex) { ModelState.AddModelError(ex, new StandardErrorHandler()); } return(Json(new JsonResponseModel(), JsonRequestBehavior.AllowGet)); }
private void TestAction(CreditInfo creditInfo) { const int count = DailyLimit + 1; var members = new Member[count]; for (var index = 0; index < count; ++index) { members[index] = CreateMember(index); } var employer = creditInfo.CreateEmployer(members); _emailServer.ClearEmails(); if (employer != null) { LogIn(employer); } // Perform the action up to the limit. var reason = GetReason(); for (var index = 0; index < DailyLimit; ++index) { _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, members[index]), reason); } // Perform the action to push it over the limit. PerformAction(employer, members[DailyLimit]); }
public void TestResumeSearchActivityXlsCredits() { var administrator = _administratorAccountsCommand.CreateTestAdministrator(1); var organisation = CreateVerifiedOrganisation(administrator.Id); var employer = _employerAccountsCommand.CreateTestEmployer(1, organisation); var member = _memberAccountsCommand.CreateTestMember(1); // Assign some credits. _allocationsCommand.CreateAllocation(new Allocation { CreatedTime = DateTime.Now.AddDays(-60), CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = 100, OwnerId = organisation.Id, }); for (var index = 2; index < 20; ++index) { _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, _memberAccountsCommand.CreateTestMember(index)), MemberAccessReason.PhoneNumberViewed); } _employerMemberViewsCommand.ViewMember(_app, employer, member); var report = _employerReportsCommand.CreateReportTemplate <ResumeSearchActivityReport>(organisation.Id); TestResults(administrator, organisation, report, ".xls", "application/vnd.ms-excel", _downloadButton); }
public void TestFilterIsUnlocked() { var member1 = CreateMember(1); var member2 = CreateMember(2); var employer = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1)); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = 20, OwnerId = employer.Id }); // Member1 has been viewed. _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member1), MemberAccessReason.PhoneNumberViewed); // Filter. TestFilter(employer, CreateIsUnlockedCriteria, new[] { member1.Id, member2.Id }, new[] { member1.Id }, new[] { member2.Id }); }
private Member CreateMember(IEmployer employer, int index, bool isUnlocked) { var member = CreateMember(index); if (isUnlocked) { var view = _employerMemberViewsQuery.GetProfessionalView(employer, member); _employerMemberViewsCommand.AccessMember(_app, employer, view, MemberAccessReason.Unlock); } return(member); }
public void TestGetEmailMemberUnlockings() { var channel = _channelsQuery.GetChannel("Web"); var app = _channelsQuery.GetChannelApp(channel.Id, "Web"); Assert.AreEqual(0, _employerMemberAccessReportsQuery.GetEmployerMemberAccessReport(channel, DayRange.Today).MessagesSent); // Make some contacts. var employer1 = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1)); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer1.Id }); var employer2 = _employersCommand.CreateTestEmployer(2, _organisationsCommand.CreateTestOrganisation(2)); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer2.Id }); var member1 = _membersCommand.CreateTestMember(1); _userAccountsCommand.EnableUserAccount(member1, Guid.NewGuid()); member1 = _membersQuery.GetMember(member1.Id); var member2 = _membersCommand.CreateTestMember(2); _userAccountsCommand.EnableUserAccount(member2, Guid.NewGuid()); member2 = _membersQuery.GetMember(member2.Id); var member3 = _membersCommand.CreateTestMember(3); _userAccountsCommand.EnableUserAccount(member3, Guid.NewGuid()); member3 = _membersQuery.GetMember(member3.Id); _employerMemberViewsCommand.AccessMember(app, employer1, _employerMemberViewsQuery.GetProfessionalView(employer1, member1), MemberAccessReason.MessageSent); Assert.AreEqual(1, _employerMemberAccessReportsQuery.GetEmployerMemberAccessReport(channel, DayRange.Today).MessagesSent); _employerMemberViewsCommand.AccessMember(app, employer1, _employerMemberViewsQuery.GetProfessionalView(employer1, member2), MemberAccessReason.MessageSent); Assert.AreEqual(2, _employerMemberAccessReportsQuery.GetEmployerMemberAccessReport(channel, DayRange.Today).MessagesSent); _employerMemberViewsCommand.AccessMember(app, employer2, _employerMemberViewsQuery.GetProfessionalView(employer2, member1), MemberAccessReason.MessageSent); Assert.AreEqual(3, _employerMemberAccessReportsQuery.GetEmployerMemberAccessReport(channel, DayRange.Today).MessagesSent); _employerMemberViewsCommand.AccessMember(app, employer2, _employerMemberViewsQuery.GetProfessionalView(employer2, member3), MemberAccessReason.MessageSent); Assert.AreEqual(4, _employerMemberAccessReportsQuery.GetEmployerMemberAccessReport(channel, DayRange.Today).MessagesSent); }
public void TestLimitedContactedPhoto() { var member = CreateMember(); var employer = CreateEmployer(100); _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), MemberAccessReason.Unlock); // Get the photo. LogIn(employer); Get(GetPhotoUrl(member.Id)); // Can see the photo because the member has been unlocked. Assert.AreEqual(HttpStatusCode.OK, Browser.CurrentStatusCode); Assert.AreEqual("image/jpeg", Browser.ResponseHeaders["Content-Type"]); }
public void TestHasBeenAccessed() { var employer0 = CreateEmployer(0); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer0.Id }); var employer1 = CreateEmployer(1, employer0.Organisation); var member = CreateMember(0); var view = _employerMemberViewsQuery.GetProfessionalView(employer0, member); _employerMemberViewsCommand.CheckCanAccessMember(_app, employer0, view, MemberAccessReason.MessageSent); _employerMemberViewsCommand.AccessMember(_app, employer0, view, MemberAccessReason.MessageSent); TestFlag(employer0, member.Id, true, v => v.HasBeenAccessed); TestFlag(employer1, member.Id, false, v => v.HasBeenAccessed); }
void IEmployerMemberContactsCommand.ContactMember(ChannelApp app, IEmployer employer, ProfessionalView view, ContactMemberMessage messageTemplate) { var cleaner = new MemberMessageCleaner(); var cleanedBody = cleaner.CleanBody(messageTemplate.Body); var cleanedSubject = cleaner.CleanSubject(messageTemplate.Subject); // Messages are being sent so exercise a credit. var access = _employerMemberViewsCommand.AccessMember(app, employer, view, MemberAccessReason.MessageSent); // Save the message. if (access != null) { var handlers = MessageCreated; var representativeId = _memberContactsQuery.GetRepresentativeContact(view.Id); ContactMember(messageTemplate, employer, view, cleanedSubject, cleanedBody, representativeId, access, handlers); } }
private void Contact(IEmployer employer, Member member) { var view = _employerMemberViewsQuery.GetProfessionalView(employer, member); _employerMemberViewsCommand.AccessMember(_app, employer, view, MemberAccessReason.Unlock); }
protected void AccessMember(Employer employer, Member member) { var view = _employerMemberViewsQuery.GetProfessionalView(employer, member); _employerMemberViewsCommand.AccessMember(_app, employer, view, MemberAccessReason.Unlock); }
public void TestEmployers() { var credit = _creditsQuery.GetCredit <ContactCredit>(); var unlimited = CreateEmployer(0); _allocationsCommand.CreateAllocation(new Allocation { CreditId = credit.Id, OwnerId = unlimited.Id, InitialQuantity = null }); var limited = CreateEmployer(1); _allocationsCommand.CreateAllocation(new Allocation { CreditId = credit.Id, OwnerId = limited.Id, InitialQuantity = 10 }); var none = CreateEmployer(2); _allocationsCommand.CreateAllocation(new Allocation { CreditId = credit.Id, OwnerId = none.Id, InitialQuantity = 1 }); var hasNotAccessed = _memberAccountsCommand.CreateTestMember(0); var candidate = _candidatesQuery.GetCandidate(hasNotAccessed.Id); _candidateResumesCommand.AddTestResume(candidate); var hasAccessed = _memberAccountsCommand.CreateTestMember(1); candidate = _candidatesQuery.GetCandidate(hasAccessed.Id); _candidateResumesCommand.AddTestResume(candidate); _employerMemberViewsCommand.AccessMember(_app, unlimited, _employerMemberViewsQuery.GetProfessionalView(unlimited, hasAccessed), MemberAccessReason.Unlock); _employerMemberViewsCommand.AccessMember(_app, limited, _employerMemberViewsQuery.GetProfessionalView(limited, hasAccessed), MemberAccessReason.Unlock); _employerMemberViewsCommand.AccessMember(_app, none, _employerMemberViewsQuery.GetProfessionalView(none, hasAccessed), MemberAccessReason.Unlock); }