protected void AssertEmployerCreditUsage <T>(IEmployer employer, ICreditOwner owner, bool hasExercisedCredit, params UsedOn[] usedOns) where T : Credit { Get(GetCreditsUsageUrl(employer)); var nodes = Browser.CurrentHtml.DocumentNode.SelectNodes("//table[@class='list']/tbody/tr"); if (hasExercisedCredit) { AssertPageDoesNotContain("This employer has not used any credits."); Assert.IsTrue(nodes != null && nodes.Count == usedOns.Length); foreach (var node in nodes) { Assert.AreEqual(_creditsQuery.GetCredit <T>().ShortDescription, node.SelectSingleNode("td[position()=2]").InnerText); if (owner != null) { Assert.AreEqual(owner.FullName, node.SelectSingleNode("td[position()=3]/a").InnerText); } Assert.IsTrue((from u in usedOns where u.Name == node.SelectSingleNode("td[position()=4]/a").InnerText select u).Any()); } } else { Assert.IsTrue(nodes == null || nodes.Count == 0); AssertPageContains("This employer has not used any credits."); } }
protected void AssertEmployerCredits(Order order, ReadOnlyUrl orderUrl, IEnumerable <ProductCreditAdjustment> creditAdjustments, DateTime expiryDate) { AssertUrl(_creditsUrl); foreach (var creditAdjustment in creditAdjustments) { var found = false; var credit = _creditsQuery.GetCredit(creditAdjustment.CreditId); var trNodes = Browser.CurrentHtml.DocumentNode.SelectNodes("//table[@id='personal-credits']//tr"); Assert.IsNotNull(trNodes); foreach (var trNode in trNodes) { var childNodes = trNode.ChildNodes.Where(n => !string.IsNullOrEmpty(n.InnerText.Trim())).ToList(); if (childNodes[0].InnerText == credit.ShortDescription && childNodes[1].InnerText == (creditAdjustment.Quantity == null ? "unlimited" : creditAdjustment.Quantity.ToString()) && childNodes[2].InnerText == expiryDate.ToShortDateString() && childNodes[3].InnerHtml.Equals(GetOrderLink(order, orderUrl), StringComparison.OrdinalIgnoreCase)) { found = true; break; } } if (!found) { Assert.Fail("Credit not found."); } } }
public void TestNoCriteria() { // Create an employer and search. var employer = CreateEmployer(0, false); _allocationsCommand.CreateAllocation(new Allocation { OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id }); var criteria = new MemberSearchCriteria(); var search = new MemberSearch { OwnerId = employer.Id, Criteria = criteria }; // Some results. var results = CreateResults(1, false, false, false); var email = SendAlertEmail(employer, search, results); AssertMail(email, employer, search, results, 0, 0, false); // No results. results = CreateResults(0, false, false, false); email = SendAlertEmail(employer, search, results); AssertMail(email, employer, search, results, 0, 0, false); }
protected Allocation GetEffectiveActiveAllocation <TCredit>(IEnumerable <Guid> ownerIds) where TCredit : Credit { var credit = _creditsQuery.GetCredit <TCredit>(); return(GetEffectiveAllocation(_allocationsQuery.GetActiveAllocations(ownerIds, new[] { credit.Id }).SelectMany(a => a.Value))); }
public void TestInitialize() { _contactCredit = _creditsQuery.GetCredit <ContactCredit>(); _jobAdCredit = _creditsQuery.GetCredit <JobAdCredit>(); _applicantCredit = _creditsQuery.GetCredit <ApplicantCredit>(); _openJobAdsUrl = new ReadOnlyApplicationUrl(true, "~/ui/registered/employers/EmployerJobAds.aspx?mode=Open"); }
public void TestLimitedSearches() { var employer = CreateEmployer(); _allocationsCommand.CreateAllocation(new Allocation { OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = 10 }); TestSearches(employer, true, 10); }
private void Allocate(Guid ownerId, int?applicantCredits, int?jobAdCredits) { _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, OwnerId = ownerId, InitialQuantity = applicantCredits }); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, OwnerId = ownerId, InitialQuantity = jobAdCredits }); }
private IDictionary <Credit, Allocation> GetAllocations(IEmployer employer) { return(new Dictionary <Credit, Allocation> { { _creditsQuery.GetCredit <ContactCredit>(), _employerCreditsQuery.GetEffectiveActiveAllocation <ContactCredit>(employer) }, { _creditsQuery.GetCredit <ApplicantCredit>(), _employerCreditsQuery.GetEffectiveActiveAllocation <ApplicantCredit>(employer) }, { _creditsQuery.GetCredit <JobAdCredit>(), _employerCreditsQuery.GetEffectiveActiveAllocation <JobAdCredit>(employer) }, }); }
public void TestAddCredits() { var administrator = _administratorAccountsCommand.CreateTestAdministrator(1); var organisation = _organisationsCommand.CreateTestVerifiedOrganisation(1, null, administrator.Id); LogIn(administrator); Get(GetCreditsUrl(organisation)); // Add some. Credit credit = _creditsQuery.GetCredit <ContactCredit>(); var allocations = new List <Allocation>(); int? quantity = null; DateTime?expiryDate = null; _creditIdDropDownList.SelectedIndex = 1; _addButton.Click(); allocations.Add(new Allocation { CreditId = credit.Id, InitialQuantity = quantity, ExpiryDate = expiryDate }); AssertAllocations(organisation.Id, allocations); // Add more. credit = _creditsQuery.GetCredit <JobAdCredit>(); quantity = 20; expiryDate = DateTime.Now.Date.AddYears(1); _creditIdDropDownList.SelectedValue = credit.Id.ToString(); _quantityTextBox.Text = quantity.ToString(); _expiryDateTextBox.Text = expiryDate.Value.ToString("dd/MM/yyyy"); _addButton.Click(); allocations.Add(new Allocation { CreditId = credit.Id, RemainingQuantity = quantity, ExpiryDate = expiryDate }); AssertAllocations(organisation.Id, allocations); // Add more. credit = _creditsQuery.GetCredit <ApplicantCredit>(); quantity = null; expiryDate = DateTime.Now.Date.AddYears(1); _creditIdDropDownList.SelectedValue = credit.Id.ToString(); _quantityTextBox.Text = string.Empty; _expiryDateTextBox.Text = expiryDate.Value.ToString("dd/MM/yyyy"); _addButton.Click(); allocations.Add(new Allocation { CreditId = credit.Id, RemainingQuantity = quantity, ExpiryDate = expiryDate }); AssertAllocations(organisation.Id, allocations); }
protected Product GetContactProduct() { // Select the first product that has a single credit adjustment for the given type. var credit = _creditsQuery.GetCredit <ContactCredit>(); return((from p in _productsQuery.GetProducts() where p.CreditAdjustments.Count == 1 && p.CreditAdjustments[0].CreditId == credit.Id select p).First()); }
protected Employer CreateEmployer(int index, int?jobAdCredits) { var employer = CreateEmployer(index); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = jobAdCredits, OwnerId = employer.Id }); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, InitialQuantity = null, OwnerId = employer.Id }); return(employer); }
protected Employer CreateEmployer(int index) { var employer = _employerAccountsCommand.CreateTestEmployer(index, _organisationsCommand.CreateTestOrganisation(index)); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = null, OwnerId = employer.Id }); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, InitialQuantity = null, OwnerId = employer.Id }); return(employer); }
private Employer CreateEmployer() { var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestVerifiedOrganisation(0)); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = null, OwnerId = employer.Id }); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, InitialQuantity = null, OwnerId = employer.Id }); return(employer); }
private Employer CreateEmployer() { var employer = _employerAccountsCommand.CreateTestEmployer(TestEmployerUserId, _organisationsCommand.CreateTestOrganisation(0)); _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 }); return(employer); }
public void TestUnlimitedJobAdCreditsExistingLimitedApplicantCredits() { var employer = CreateEmployer(); _allocationsCommand.CreateAllocation(new Allocation { OwnerId = employer.Id, InitialQuantity = 50, ExpiryDate = DateTime.Now.AddMonths(1), CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id }); AllocateJobAdCredits(employer.Id, null, DateTime.Now.Date.AddYears(1)); AssertAllocation <JobAdCredit>(employer.Id, null, DateTime.Now.Date.AddYears(1)); AssertAllocations <ApplicantCredit>(employer.Id, 50, DateTime.Now.Date.AddMonths(1), null, DateTime.Now.Date.AddYears(1).AddMonths(2)); }
public void TestVerifiedAllocations() { var credit = _creditsQuery.GetCredit <ContactCredit>(); var index = 0; // Add some employers, with various allocations. IList <IEmployer> employers = new List <IEmployer>(); // Employer allocations. var employer = CreateEmployer(ref index, true, credit, 100, null); employers.Add(employer); employer = CreateEmployer(ref index, true, credit, 100, 100); employers.Add(employer); employer = CreateEmployer(ref index, true, credit, 100, 0); employers.Add(employer); CreateEmployer(ref index, true, credit, -10, null); CreateEmployer(ref index, true, credit, -10, 100); CreateEmployer(ref index, true, credit, -10, 0); // Organisation allocations. employer = CreateOrganisationEmployer(ref index, true, credit, 100, null); employers.Add(employer); employer = CreateOrganisationEmployer(ref index, true, credit, 100, 100); employers.Add(employer); employer = CreateOrganisationEmployer(ref index, true, credit, 100, 0); employers.Add(employer); CreateOrganisationEmployer(ref index, true, credit, -10, null); CreateOrganisationEmployer(ref index, true, credit, -10, 100); CreateOrganisationEmployer(ref index, true, credit, -10, 0); // Parent organisation allocations. employer = CreateParentOrganisationEmployer(ref index, credit, 100, null); employers.Add(employer); employer = CreateParentOrganisationEmployer(ref index, credit, 100, 100); employers.Add(employer); employer = CreateParentOrganisationEmployer(ref index, credit, 100, 0); employers.Add(employer); CreateParentOrganisationEmployer(ref index, credit, -10, null); CreateParentOrganisationEmployer(ref index, credit, -10, 100); CreateParentOrganisationEmployer(ref index, credit, -10, 0); new EmailEmployerNewsletterTask(_emailsCommand, _employersQuery, _userAccountsQuery, _allocationsQuery, _recruitersQuery).ExecuteTask(); AssertEmails(employers); }
protected Employer CreateEmployer(int?credits, Organisation organisation) { var employer = _employerAccountsCommand.CreateTestEmployer(1, organisation); if (credits == null || credits.Value != 0) { _allocationsCommand.CreateAllocation(new Allocation { OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = credits }); _allocationsCommand.CreateAllocation(new Allocation { OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id }); } return(employer); }
public Employer CreateEmployer(int?quantity, DateTime?expiryDate) { var employer = CreateEmployer(_creditAllocation == Candidates.CreditAllocation.ParentOrganisation); Guid ownerId; switch (_creditAllocation) { case Candidates.CreditAllocation.ParentOrganisation: ownerId = ((Organisation)employer.Organisation).ParentId.Value; break; case Candidates.CreditAllocation.Organisation: ownerId = employer.Organisation.Id; break; default: ownerId = employer.Id; break; } var allocation = new Allocation { OwnerId = ownerId, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = quantity, ExpiryDate = expiryDate }; _allocationsCommand.CreateAllocation(allocation); _allocationId = allocation.Id; return(employer); }
private void TestSortOrder(IEmployer employer, MemberSortOrder sortOrder, params Member[] members) { // Give the employer some credits to see the mmebers. _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer.Id }); var blockList = _candidateBlockListsQuery.GetPermanentBlockList(employer); // Add members to folder. _candidateListsCommand.AddCandidatesToBlockList(employer, blockList, from m in members select m.Id); LogIn(employer); // Test ascending. Get(GetBlockListUrl(blockList.BlockListType, sortOrder, true)); AssertSortOrders(SortOrders, sortOrder, true); AssertMembers(true, members); // Test descending, order should be reversed. Get(GetBlockListUrl(blockList.BlockListType, sortOrder, false)); AssertSortOrders(SortOrders, sortOrder, false); AssertMembers(true, members.Reverse().ToArray()); }
public void TestDateUpdated() { var member0 = CreateMember(0); var candidate0 = _candidatesQuery.GetCandidate(member0.Id); var resume0 = _resumesQuery.GetResume(candidate0.ResumeId.Value); UpdateMember(member0, candidate0, resume0, DateTime.Now.AddDays(-2)); var member1 = CreateMember(1); var candidate1 = _candidatesQuery.GetCandidate(member1.Id); var resume1 = _resumesQuery.GetResume(candidate1.ResumeId.Value); UpdateMember(member1, candidate1, resume1, DateTime.Now.AddDays(-1)); // Give the employer some credits to see the mmebers. var employer = CreateEmployer(); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer.Id }); LogIn(employer); var criteria = new MemberSearchCriteria(); criteria.SetKeywords(BusinessAnalyst); TestSortOrder(criteria, MemberSortOrder.DateUpdated, member1, member0); }
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 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 static void SetCreditAllocations(this ViewDataDictionary viewData, Employer employer) { if (employer != null) { var contactCredit = _creditsQuery.GetCredit <ContactCredit>(); var applicantCredit = _creditsQuery.GetCredit <ApplicantCredit>(); var jobAdCredit = _creditsQuery.GetCredit <JobAdCredit>(); var allocations = _employerCreditsQuery.GetEffectiveActiveAllocations(employer, new[] { contactCredit.Id, applicantCredit.Id, jobAdCredit.Id }); viewData[ViewDataKeys.CreditAllocationsKey] = new Dictionary <Credit, Allocation> { { contactCredit, allocations[contactCredit.Id] }, { applicantCredit, allocations[applicantCredit.Id] }, { jobAdCredit, allocations[jobAdCredit.Id] }, }; } }
protected void CreateAllocation(Guid ownerId, bool allocate, int?jobAdCredits, int?applicantCredits) { if (allocate) { _allocation = new Allocation { CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = jobAdCredits, OwnerId = ownerId }; _allocationsCommand.CreateAllocation(_allocation); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, InitialQuantity = applicantCredits, OwnerId = ownerId }); } else { _allocation = null; } }
/* [TestMethod] * public void TestFilterBlockHasAccessed() * { * var member = CreateMember(1); * 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 contacted. * * _employerMemberViewsCommand.AccessMember(employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), MemberAccessReason.PhoneNumberViewed); * * // Filter. * * TestFilter(new[] { member.Id }, employer, CreateHasAccessedCriteria(true)); * * // Block. * * _candidateListsCommand.AddCandidateToBlockList(employer, _candidateBlockListsQuery.GetTemporaryCandidateBlockList(employer), member.Id); * TestFilter(new Guid[0], employer, CreateHasAccessedCriteria(true)); * } * * [TestMethod] * public void TestFilterAll() * { * var employer = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1)); * _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit<ContactCredit>().Id, InitialQuantity = 20, OwnerId = employer.Id }); * * // Create members. * * var memberIds = new Guid[6]; * memberIds[0] = CreateMember(employer, 0, false, false, false, false, false).Id; * memberIds[1] = CreateMember(employer, 1, true, false, false, false, false).Id; * memberIds[2] = CreateMember(employer, 2, true, true, false, false, false).Id; * memberIds[3] = CreateMember(employer, 3, true, true, true, false, false).Id; * memberIds[4] = CreateMember(employer, 4, true, true, true, true, false).Id; * memberIds[5] = CreateMember(employer, 5, true, true, true, true, true).Id; * * // None set. * * var criteria = new AdvancedMemberSearchCriteria(); * TestFilter(new[] { memberIds[0], memberIds[1], memberIds[2], memberIds[3], memberIds[4], memberIds[5] }, employer, criteria); * * // All true. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, IsFlagged = true, HasNotes = true, HasViewed = true, HasAccessed = true }; * TestFilter(new[] { memberIds[5] }, employer, criteria); * * // All false. * * criteria = new AdvancedMemberSearchCriteria { InFolder = false, IsFlagged = false, HasNotes = false, HasViewed = false, HasAccessed = false }; * TestFilter(new[] { memberIds[0] }, employer, criteria); * * // In folder. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true }; * TestFilter(new[] { memberIds[1], memberIds[2], memberIds[3], memberIds[4], memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { InFolder = false }; * TestFilter(new[] { memberIds[0] }, employer, criteria); * * // Is flagged. * * criteria = new AdvancedMemberSearchCriteria { IsFlagged = true }; * TestFilter(new[] { memberIds[2], memberIds[3], memberIds[4], memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { IsFlagged = false }; * TestFilter(new[] { memberIds[0], memberIds[1] }, employer, criteria); * * // Has notes. * * criteria = new AdvancedMemberSearchCriteria { HasNotes = true }; * TestFilter(new[] { memberIds[3], memberIds[4], memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasNotes = false }; * TestFilter(new[] { memberIds[0], memberIds[1], memberIds[2] }, employer, criteria); * * // Has viewed. * * criteria = new AdvancedMemberSearchCriteria { HasViewed = true }; * TestFilter(new[] { memberIds[4], memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasViewed = false }; * TestFilter(new[] { memberIds[0], memberIds[1], memberIds[2], memberIds[3] }, employer, criteria); * * // Can contact. * * criteria = new AdvancedMemberSearchCriteria { HasAccessed = true }; * TestFilter(new[] { memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasAccessed = false }; * TestFilter(new[] { memberIds[0], memberIds[1], memberIds[2], memberIds[3], memberIds[4] }, employer, criteria); * * // Some true. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, HasNotes = true }; * TestFilter(new[] { memberIds[3], memberIds[4], memberIds[5] }, employer, criteria); * * // Some false. * * criteria = new AdvancedMemberSearchCriteria { HasNotes = false, HasAccessed = false }; * TestFilter(new[] { memberIds[0], memberIds[1], memberIds[2] }, employer, criteria); * * // Some true, some false. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, HasAccessed = false }; * TestFilter(new[] { memberIds[1], memberIds[2], memberIds[3], memberIds[4] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasNotes = true, HasAccessed = false }; * TestFilter(new[] { memberIds[3], memberIds[4] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, IsFlagged = true, HasViewed = false, HasAccessed = false }; * TestFilter(new[] { memberIds[2], memberIds[3] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { InFolder = false, IsFlagged = false, HasViewed = true, HasAccessed = true }; * TestFilter(new Guid[0], employer, criteria); * * // Block some members. * * _candidateListsCommand.AddCandidateToBlockList(employer, _candidateBlockListsQuery.GetTemporaryCandidateBlockList(employer), memberIds[1]); * _candidateListsCommand.AddCandidateToBlockList(employer, _candidateBlockListsQuery.GetPermanentCandidateBlockList(employer), memberIds[4]); * * // Do it again. * * // None set. * * criteria = new AdvancedMemberSearchCriteria(); * TestFilter(new[] { memberIds[0], memberIds[2], memberIds[3], memberIds[5] }, employer, criteria); * * // All true. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, IsFlagged = true, HasNotes = true, HasViewed = true, HasAccessed = true }; * TestFilter(new[] { memberIds[5] }, employer, criteria); * * // All false. * * criteria = new AdvancedMemberSearchCriteria { InFolder = false, IsFlagged = false, HasNotes = false, HasViewed = false, HasAccessed = false }; * TestFilter(new[] { memberIds[0] }, employer, criteria); * * // In folder. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true }; * TestFilter(new[] { memberIds[2], memberIds[3], memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { InFolder = false }; * TestFilter(new[] { memberIds[0] }, employer, criteria); * * // Is flagged. * * criteria = new AdvancedMemberSearchCriteria { IsFlagged = true }; * TestFilter(new[] { memberIds[2], memberIds[3], memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { IsFlagged = false }; * TestFilter(new[] { memberIds[0] }, employer, criteria); * * // Has notes. * * criteria = new AdvancedMemberSearchCriteria { HasNotes = true }; * TestFilter(new[] { memberIds[3], memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasNotes = false }; * TestFilter(new[] { memberIds[0], memberIds[2] }, employer, criteria); * * // Has viewed. * * criteria = new AdvancedMemberSearchCriteria { HasViewed = true }; * TestFilter(new[] { memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasViewed = false }; * TestFilter(new[] { memberIds[0], memberIds[2], memberIds[3] }, employer, criteria); * * // Can contact. * * criteria = new AdvancedMemberSearchCriteria { HasAccessed = true }; * TestFilter(new[] { memberIds[5] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasAccessed = false }; * TestFilter(new[] { memberIds[0], memberIds[2], memberIds[3] }, employer, criteria); * * // Some true. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, HasNotes = true }; * TestFilter(new[] { memberIds[3], memberIds[5] }, employer, criteria); * * // Some false. * * criteria = new AdvancedMemberSearchCriteria { HasNotes = false, HasAccessed = false }; * TestFilter(new[] { memberIds[0], memberIds[2] }, employer, criteria); * * // Some true, some false. * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, HasAccessed = false }; * TestFilter(new[] { memberIds[2], memberIds[3] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { HasNotes = true, HasAccessed = false }; * TestFilter(new[] { memberIds[3] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { InFolder = true, IsFlagged = true, HasViewed = false, HasAccessed = false }; * TestFilter(new[] { memberIds[2], memberIds[3] }, employer, criteria); * * criteria = new AdvancedMemberSearchCriteria { InFolder = false, IsFlagged = false, HasViewed = true, HasAccessed = true }; * TestFilter(new Guid[0], employer, criteria); * } */ private Employer CreateEmployer(int index) { var employer = _employerAccountsCommand.CreateTestEmployer(index, _organisationsCommand.CreateTestOrganisation(index)); var credit = _creditsQuery.GetCredit <ContactCredit>(); _allocationsCommand.CreateAllocation(new Allocation { CreditId = credit.Id, InitialQuantity = null, OwnerId = employer.Id }); var jobAdCredit = _creditsQuery.GetCredit <JobAdCredit>(); _allocationsCommand.CreateAllocation(new Allocation { CreditId = jobAdCredit.Id, InitialQuantity = null, OwnerId = employer.Id }); return(employer); }
protected override Employer CreateEmployer() { var employer = base.CreateEmployer(); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = null, OwnerId = employer.Id }); return(employer); }
private JobAd CreateJobAd(bool isHighlighted) { var employer = CreateEmployer(0); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, OwnerId = employer.Id, InitialQuantity = null }); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, OwnerId = employer.Id, InitialQuantity = null }); var jobAd = employer.CreateTestJobAd(Keywords); jobAd.Features = isHighlighted ? JobAdFeatures.Highlight : JobAdFeatures.None; _employerJobAdsCommand.CreateJobAd(employer, jobAd); _employerJobAdsCommand.OpenJobAd(employer, jobAd, false); return(jobAd); }
private Employer CreateEmployer(int index) { var employer = _employerAccountsCommand.CreateTestEmployer(string.Format(LoginIdFormat, index), _organisationsCommand.CreateTestOrganisation(0)); _allocationsCommand.CreateAllocation(new Allocation { OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id }); return(employer); }
protected Employer CreateEmployer(int index) { var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0)); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer.Id }); return(employer); }
private IEmployer CreateEmployer() { var employer = _employersCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0)); _allocationsCommand.CreateAllocation(new Allocation { CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, OwnerId = employer.Id }); return(employer); }