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."); } }
private void SomeCreditsUsedCredit(IEmployer employer, Member member, ICreditOwner owner) { _allocationsCommand.CreateAllocation(new Allocation { OwnerId = owner.Id, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = 10 }); _employerCreditsCommand.ExerciseContactCredit(employer, _employerMemberViewsQuery.GetEmployerMemberView(employer, member)); }
private void UnlimitedCredits(ICreditOwner owner) { _allocationsCommand.CreateAllocation(new Allocation { OwnerId = owner.Id, CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, InitialQuantity = null }); _allocationsCommand.CreateAllocation(new Allocation { OwnerId = owner.Id, CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = null }); }
private IList <Allocation> UnlimitedCreditsNoApplicantCredits(ICreditOwner owner) { var allocation1 = new Allocation { OwnerId = owner.Id, CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = null }; var allocation2 = new Allocation { OwnerId = owner.Id, CreditId = _creditsQuery.GetCredit <ApplicantCredit>().Id, InitialQuantity = 0 }; _allocationsCommand.CreateAllocation(allocation1); _allocationsCommand.CreateAllocation(allocation2); return(new[] { allocation1, allocation2 }); }
private void UnlimitedCredits(IEmployer employer, IMember member, ICreditOwner owner) { _allocationsCommand.CreateAllocation(new Allocation { OwnerId = owner.Id, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = null }); }
private static void NoAllocate(IEmployer employer, IMember member, ICreditOwner owner) { }
private void AssertCredits <T>(IUser administrator, IEmployer employer, UsedOn usedOn, ICreditOwner owner, bool hasExercisedCredit, Allocation allocation, Allocation[] allAllocations) where T : Credit { LogIn(administrator); // Check who the employer has exercised credits on. AssertEmployerCreditUsage <T>(employer, owner, hasExercisedCredit, usedOn); if (owner is Employer) { // Check their credits. AssertEmployerCredits(employer, allAllocations); // Check the allocation. if (allocation != null) { AssertEmployerCreditUsage(employer, allocation, hasExercisedCredit, usedOn); } } else if (owner is Organisation) { var organisation = owner as Organisation; // Check their credits. AssertOrganisationCredits(organisation, allAllocations); // Check who has used the organisation's credits. AssertOrganisationCreditUsage <T>(organisation, employer, hasExercisedCredit, usedOn); // Check the allocation. if (allocation != null) { AssertOrganisationCreditUsage(organisation, employer, allocation, hasExercisedCredit, usedOn); } } LogOut(); }
protected void AssertCredits <T>(Administrator administrator, Employer employer, JobAdEntry jobAd, ICreditOwner owner, bool hasExercisedCredit, Allocation allocation, Allocation[] allAllocations) where T : Credit { AssertCredits <T>(administrator, employer, jobAd == null ? null : new UsedOnJobAd(jobAd), owner, hasExercisedCredit, allocation, allAllocations); }
protected void AssertCredits <T>(Administrator administrator, Employer employer, Member member, ICreditOwner owner, bool hasExercisedCredit, Allocation allocation, Allocation[] allAllocations) where T : Credit { AssertCredits <T>(administrator, employer, new UsedOnMember(member), owner, hasExercisedCredit, allocation, allAllocations); }
protected void AssertEmployerCreditUsage <T>(IEmployer employer, ICreditOwner owner, bool hasExercisedCredit, params Member[] members) where T : Credit { AssertEmployerCreditUsage <T>(employer, owner, hasExercisedCredit, (from m in members select(UsedOn) new UsedOnMember(m)).ToArray()); }
private static void NoAllocate(ICreditOwner owner) { }
private static IList <Allocation> NoAllocate(ICreditOwner owner) { return(new List <Allocation>()); }