public async Task HasEmailOverlapsIsMappedCorrectlyWhenThereAreEmailOverlaps()
        {
            var fixture = new DetailsViewModelMapperTestsFixture().WithOneEmailOverlapping();
            var result  = await fixture.Map();

            Assert.IsTrue(result.HasEmailOverlaps);
        }
        public async Task EmployerCanApproveIsMappedCorrectly()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            var result  = await fixture.Map();

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

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

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

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

            Assert.AreEqual("X123X", result.TransferSenderHashedId);
        }
        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 SendBackToProviderOptionMessageIsMappedCorrectly(bool isAgreementSigned, bool employerComplete, string expected)
        {
            var fixture = new DetailsViewModelMapperTestsFixture().SetIsAgreementSigned(isAgreementSigned).SetEmployerComplete(employerComplete);
            var result  = await fixture.Map();

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

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

            Assert.AreEqual(fixture.Cohort.WithParty, result.WithParty);
        }
        public async Task IsCompleteMappedCorrectlyWhenAllManadatoryFieldArePresent()
        {
            var fixture = new DetailsViewModelMapperTestsFixture().CreateDraftApprenticeship();
            var result  = await fixture.Map();

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

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

            Assert.AreEqual(fixture.Source.AccountHashedId, result.AccountHashedId);
        }
        public async Task VerifyIsAgreementSignedEndpointIsCalledWithCorrectParams()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();
            await fixture.Map();

            fixture.CommitmentsApiClient.Verify(x => x.IsAgreementSigned(It.Is <AgreementSignedRequest>(p => p.AccountLegalEntityId == fixture.Cohort.AccountLegalEntityId &&
                                                                                                        p.AgreementFeatures == null), It.IsAny <CancellationToken>()));
        }
        public async Task ShowApprovalOptionIsMappedCorrectlyWithoutATransfer(bool isAgreementSigned, bool expectedShowApprovalOption)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

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

            Assert.AreEqual(expectedShowApprovalOption, result.EmployerCanApprove);
        }
        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 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 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 ShowApprovalOptionIsMappedCorrectlyWhenOverlap(bool hasOverlap, bool expectedEmployerCanApprove)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

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

            Assert.AreEqual(expectedEmployerCanApprove, result.EmployerCanApprove);
        }
        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 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 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 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 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 ShowHasOverlappingUlnIsMappedCorrectlyWhenOverlap(bool hasOverlap, bool hasUlnOverlap)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

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

            Assert.AreEqual(hasUlnOverlap, result.HasOverlappingUln);
        }
        public async Task ShowGotoHomePageOptionIsMappedCorrectly(bool isAgreementSigned, bool isEmployerComplete, bool expected)
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

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

            Assert.AreEqual(expected, result.ShowGotoHomePageOption);
        }
        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 VerifyIsAgreementSignedEndpointIsCalledWithCorrectParamsWhenIsFundedByTransfer()
        {
            var fixture = new DetailsViewModelMapperTestsFixture();

            fixture.SetTransferSender();
            await fixture.Map();

            fixture.CommitmentsApiClient.Verify(x => x.IsAgreementSigned(It.Is <AgreementSignedRequest>(p => p.AccountLegalEntityId == fixture.Cohort.AccountLegalEntityId &&
                                                                                                        p.AgreementFeatures.Length == 1 && p.AgreementFeatures[0] == AgreementFeature.Transfers), It.IsAny <CancellationToken>()));
        }