public void TheCohortsStatusIsSetCorrectly(CohortStatus selectedCohortStatus) { var f = new GetCohortCardLinkViewModelTestsFixture(); var result = f.GetCohortCardLinkViewModel(selectedCohortStatus); f.VerifySelectedCohortStatusIsCorrect(result, selectedCohortStatus); }
public static ApprenticeshipRequestsHeaderViewModel GetCohortCardLinkViewModel( this CohortSummary[] cohorts, IUrlHelper urlHelper, long providerId, CohortStatus selectedStatus, bool hasRelationship, ProviderAgreementStatus providerAgreementStatus) { return(new ApprenticeshipRequestsHeaderViewModel { ProviderId = providerId, ShowDrafts = hasRelationship, CohortsInDraft = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.Draft), cohorts.Count(x => x.GetStatus() == CohortStatus.Draft) == 1 ? "Draft" : "Drafts", urlHelper.Action("Draft", "Cohort", new { providerId }), CohortStatus.Draft.ToString(), selectedStatus == CohortStatus.Draft), CohortsInReview = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.Review), "Ready for review", urlHelper.Action("Review", "Cohort", new { providerId }), CohortStatus.Review.ToString(), selectedStatus == CohortStatus.Review), CohortsWithEmployer = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.WithEmployer), "With employers", urlHelper.Action("WithEmployer", "Cohort", new { providerId }), CohortStatus.WithEmployer.ToString(), selectedStatus == CohortStatus.WithEmployer), CohortsWithTransferSender = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.WithTransferSender), "With transfer sending employers", urlHelper.Action("WithTransferSender", "Cohort", new { providerId }), CohortStatus.WithTransferSender.ToString(), selectedStatus == CohortStatus.WithTransferSender), IsAgreementSigned = providerAgreementStatus == ProviderAgreementStatus.Agreed }); }
public ApprenticeshipRequestsHeaderViewModel GetCohortCardLinkViewModel(CohortStatus selectedCohortStatus = CohortStatus.Draft) { return(CohortSummaries.GetCohortCardLinkViewModel(UrlHelper.Object, accountHashed, selectedCohortStatus)); }
public void VerifySelectedCohortStatusIsCorrect(ApprenticeshipRequestsHeaderViewModel result, CohortStatus expectedCohortStatus) { Assert.AreEqual(expectedCohortStatus == CohortStatus.WithTransferSender, result.CohortsWithTransferSender.IsSelected); Assert.AreEqual(expectedCohortStatus == CohortStatus.Draft, result.CohortsInDraft.IsSelected); Assert.AreEqual(expectedCohortStatus == CohortStatus.Review, result.CohortsInReview.IsSelected); Assert.AreEqual(expectedCohortStatus == CohortStatus.WithProvider, result.CohortsWithTrainingProvider.IsSelected); }
public static ApprenticeshipRequestsHeaderViewModel GetCohortCardLinkViewModel(this CohortSummary[] cohorts, IUrlHelper urlHelper, string accountHashedId, CohortStatus selectedStatus) { return(new ApprenticeshipRequestsHeaderViewModel { AccountHashedId = accountHashedId, CohortsInDraft = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.Draft), cohorts.Count(x => x.GetStatus() == CohortStatus.Draft) == 1 ? "Draft" : "Drafts", urlHelper.Action("Draft", "Cohort", new { accountHashedId }), CohortStatus.Draft.ToString(), selectedStatus == CohortStatus.Draft), CohortsInReview = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.Review), "Ready to review", urlHelper.Action("Review", "Cohort", new { accountHashedId }), CohortStatus.Review.ToString(), selectedStatus == CohortStatus.Review), CohortsWithTrainingProvider = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.WithProvider), "With training providers", urlHelper.Action("WithTrainingProvider", "Cohort", new { accountHashedId }), CohortStatus.WithProvider.ToString(), selectedStatus == CohortStatus.WithProvider), CohortsWithTransferSender = new ApprenticeshipRequestsTabViewModel( cohorts.Count(x => x.GetStatus() == CohortStatus.WithTransferSender), "With transfer sending employers", urlHelper.Action("WithTransferSender", "Cohort", new { accountHashedId }), CohortStatus.WithTransferSender.ToString(), selectedStatus == CohortStatus.WithTransferSender) }); }
public void CohortSummary_GetStatus_Returns_Correct_Status(bool isDraft, Party withParty, CohortStatus cohortStatus) { //Arrange var cohortSummary = new CohortSummary { CohortId = 1, IsDraft = isDraft, WithParty = withParty }; //Act var status = cohortSummary.GetStatus(); //Assert Assert.AreEqual(cohortStatus, status); }
public ApprenticeshipRequestsHeaderViewModel GetCohortCardLinkViewModel(CohortStatus selectedCohortStatus = CohortStatus.Draft, bool hasRelationship = true, ProviderAgreementStatus providerAgreementStatus = ProviderAgreementStatus.Agreed) { return(CohortSummaries.GetCohortCardLinkViewModel(UrlHelper.Object, providerId, selectedCohortStatus, hasRelationship, providerAgreementStatus)); }