public async Task PledgeApplicationIdIsNullWhenThereIsNoValue()
        {
            var fixture = new DetailsViewModelMapperTestsFixture().SetPledgeApplicationIdAndItsExpectedHashedValue(null, null);
            var result  = await fixture.Map();

            Assert.IsNull(result.EncodedPledgeApplicationId);
        }
        public async Task DraftApprenticeshipTotalCountIsReportedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(fixture.DraftApprenticeshipsResponse.DraftApprenticeships.Count, result.DraftApprenticeshipsCount);
        }
        public async Task PledgeApplicationIdIsEncodedCorrectlyWhenThereIsAValue()
        {
            var fixture = new DetailsViewModelMapperTestsFixture().SetPledgeApplicationIdAndItsExpectedHashedValue(567, "Z567Z");
            var result  = await fixture.Map();

            Assert.AreEqual("Z567Z", result.EncodedPledgeApplicationId);
        }
        public async Task IsApprovedByEmployerIsMappedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(fixture.Cohort.IsApprovedByEmployer, result.IsApprovedByEmployer);
        }
        public async Task TransferSenderHashedIdIsEncodedCorrectlyWhenThereIsAValue()
        {
            var fixture = new DetailsViewModelMapperTestsFixture().SetTransferSenderIdAndItsExpectedHashedValue(123, "X123X");
            var result  = await fixture.Map();

            Assert.AreEqual("X123X", result.TransferSenderHashedId);
        }
        public async Task WithPartyIsMappedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(fixture.Cohort.WithParty, result.WithParty);
        }
        public async Task SendBackToEmployerOptionMessageIsMappedCorrectly(bool isAgreementSigned, bool providerComplete, string expected)
        {
            var fixture = new DetailsViewModelMapperTestsFixture().SetIsAgreementSigned(isAgreementSigned).SetProviderComplete(providerComplete);
            var result  = await fixture.Map();

            Assert.AreEqual(expected, result.SendBackToEmployerOptionMessage);
        }
        public async Task ProviderIdIsMappedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(fixture.Source.ProviderId, result.ProviderId);
        }
        public async Task TransferSenderHashedIdIsNullWhenThereIsNoValue()
        {
            var fixture = new DetailsViewModelMapperTestsFixture().SetTransferSenderIdAndItsExpectedHashedValue(null, null);
            var result  = await fixture.Map();

            Assert.IsNull(result.TransferSenderHashedId);
        }
        public async Task MessageIsMappedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(fixture.Cohort.LatestMessageCreatedByEmployer, result.Message);
        }
        public async Task CohortReferenceIsMappedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(fixture.Source.CohortReference, result.CohortReference);
        }
        public async Task FundingBandCapExcessLabelIsSetCorrectlyForTheNumberOfApprenticeshipsOverFundingCap(string courseCode, string expectedFundingBandCapExcessLabel)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(expectedFundingBandCapExcessLabel, result.Courses.FirstOrDefault(x => x.CourseCode == courseCode).FundingBandExcess.FundingBandCapExcessLabel);
        }
        public async Task ProviderNameIsMappedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            Assert.AreEqual(fixture.Cohort.ProviderName, result.ProviderName);
        }
        public async Task HasEmailOverlapsIsMappedCorrectlyWhenThereAreEmailOverlaps()
        {
            var fixture = new DetailsViewModelMapperTestsFixture().WithOneEmailOverlapping();
            var result  = await fixture.Map();

            Assert.IsTrue(result.HasEmailOverlaps);
        }
        public async Task ShowApprovalOptionIsMappedCorrectlyWhenOverlap(bool hasOverlap, bool expectedShowApprovalOption)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.SetUlnOverlap(hasOverlap);
            var result = await fixture.Map();

            Assert.AreEqual(expectedShowApprovalOption, result.ProviderCanApprove);
        }
        public async Task ShowAddAnotherApprenticeOptionIsMappedCorrectly(bool isChangeOfParty, bool expectedShowAddAnotherOption)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.SetIsChangeOfParty(isChangeOfParty);
            var result = await fixture.Map();

            Assert.AreEqual(expectedShowAddAnotherOption, result.ShowAddAnotherApprenticeOption);
        }
        public async Task OptionsTitleIsMappedCorrectlyWithoutATransfer(bool isAgreementSigned, string expectedOptionsTitle)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.SetIsAgreementSigned(isAgreementSigned);
            var result = await fixture.Map();

            Assert.AreEqual(expectedOptionsTitle, result.OptionsTitle);
        }
        public async Task FundingBandExcessModelIsNullForCourse3()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            var excessModel = result.Courses.FirstOrDefault(x => x.CourseCode == "C3").FundingBandExcess;

            Assert.IsNull(excessModel);
        }
        public async Task FundingBandExcessModelShowsTheSingleFundingBandCapExceeded()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            var excessModel = result.Courses.FirstOrDefault(x => x.CourseCode == "C2").FundingBandExcess;

            Assert.AreEqual(" of £1,000.", excessModel.DisplaySingleFundingBandCap);
        }
        public async Task FundingBandExcessModelShowsOneApprenticeshipExceedingTheBandForCourse2()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            var excessModel = result.Courses.FirstOrDefault(x => x.CourseCode == "C2").FundingBandExcess;

            Assert.AreEqual(1, excessModel.NumberOfApprenticesExceedingFundingBandCap);
        }
        public async Task IsAgreementSignedIsMappedCorrectlyWithoutATransfer(bool isAgreementSigned, bool expectedIsAgreementSigned)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.SetIsAgreementSigned(isAgreementSigned);
            var result = await fixture.Map();

            Assert.AreEqual(expectedIsAgreementSigned, result.IsAgreementSigned);
        }
        public async Task ShowApprovalOptionIsMappedCorrectlyWithoutATransfer(bool isAgreementSigned, bool expectedShowApprovalOption)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.SetIsAgreementSigned(isAgreementSigned);
            var result = await fixture.Map();

            Assert.AreEqual(expectedShowApprovalOption, result.ProviderCanApprove);
        }
        public async Task ShowViewAgreementOptionIsMappedCorrectlyWithATransfer(bool isAgreementSigned, bool expectedShowViewAgreementOption)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.SetTransferSender().SetIsAgreementSigned(isAgreementSigned);
            var result = await fixture.Map();

            Assert.AreEqual(expectedShowViewAgreementOption, result.ShowViewAgreementOption);
        }
        public async Task IsCompleteMappedCorrectlyWhenAManadatoryFieldIsNull(string propertyName)
        {
            var fixture = new DetailsViewModelMapperTestsFixture()
                          .CreateDraftApprenticeship()
                          .SetValueOfDraftApprenticeshipProperty(propertyName, null);
            var result = await fixture.Map();

            Assert.IsFalse(result.Courses.First().DraftApprenticeships.First().IsComplete);
        }
        public async Task FundingBandExcessModelShowsOnlyTheFullStopWhenMultipleFundingCapsAreExceeded()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

            var excessModel = result.Courses.FirstOrDefault(x => x.CourseCode == "C1").FundingBandExcess;

            Assert.AreEqual(".", excessModel.DisplaySingleFundingBandCap);
        }
        public async Task PageTitleIsSetCorrectlyForTheNumberOfApprenticeships(int numberOfApprenticeships, string expectedPageTitle, Party withParty)
        {
            var fixture = new DetailsViewModelMapperTestsFixture().CreateThisNumberOfApprenticeships(numberOfApprenticeships);

            fixture.Cohort.WithParty = withParty;

            var result = await fixture.Map();

            Assert.AreEqual(expectedPageTitle, result.PageTitle);
        }
        public async Task ShowApprovalOptionMessageIsMappedCorrectlyWithoutATransfer(bool isAgreementSigned, bool showApprovalOption,
                                                                                     bool isApprovedByEmployer, bool expectedShowApprovalOptionMessage)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.Cohort.IsApprovedByEmployer = isApprovedByEmployer;
            fixture.SetIsAgreementSigned(isAgreementSigned);
            var result = await fixture.Map();

            Assert.AreEqual(expectedShowApprovalOptionMessage, result.ShowApprovalOptionMessage);
        }
        public async Task StatusIsMappedCorrectly_When_With_Employer_But_Without_Employer_Approval()
        {
            var fixture = new DetailsViewModelMapperTestsFixture()
                          .CreateThisNumberOfApprenticeships(1)
                          .SetCohortWithParty(Party.Employer);

            fixture.Cohort.LastAction = LastAction.Amend;

            var result = await fixture.Map();

            Assert.AreEqual("Under review with employer", result.Status);
        }
        public async Task StatusIsMappedCorrectly_When_WithEmployer_And_New_Cohort()
        {
            var fixture = new DetailsViewModelMapperTestsFixture()
                          .CreateThisNumberOfApprenticeships(1)
                          .SetCohortWithParty(Party.Employer);

            fixture.Cohort.LastAction = LastAction.None;

            var result = await fixture.Map();

            Assert.AreEqual("New request", result.Status);
        }
        public async Task StatusIsMappedCorrectly_When_With_Provider_With_Employer_Approval()
        {
            var fixture = new DetailsViewModelMapperTestsFixture()
                          .CreateThisNumberOfApprenticeships(1)
                          .SetCohortWithParty(Party.Provider);

            fixture.Cohort.LastAction           = LastAction.Approve;
            fixture.Cohort.IsApprovedByEmployer = true;

            var result = await fixture.Map();

            Assert.AreEqual("Ready for approval", result.Status);
        }