public async Task MessageIsMappedCorrectly()
        {
            var fixture = new WhenMappingAcknowledgementRequestToViewModelTestsFixture();
            var result  = await fixture.Map();

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

            Assert.AreEqual(fixture.Source.CohortReference, result.CohortReference);
        }
        public async Task ProviderNameIsMappedCorrectly()
        {
            var fixture = new WhenMappingAcknowledgementRequestToViewModelTestsFixture();
            var result  = await fixture.Map();

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

            Assert.AreEqual(fixture.Cohort.WithParty, result.WithParty);
        }
        public async Task WhenNoMessageIsSpecifiedMessageIsMappedCorrectly()
        {
            var fixture = new WhenMappingAcknowledgementRequestToViewModelTestsFixture();

            fixture.Cohort.LatestMessageCreatedByProvider = string.Empty;

            var result = await fixture.Map();

            Assert.AreEqual("No message added", result.Message);
        }
        public async Task ThenPageTitleMappedCorrectly(bool isApprovedByProvider, bool isApprovedByEmployer, SaveStatus saveStatus, string expectedText)
        {
            var fixture = new WhenMappingAcknowledgementRequestToViewModelTestsFixture();

            fixture.Cohort.IsApprovedByProvider = isApprovedByProvider;
            fixture.Cohort.IsApprovedByEmployer = isApprovedByEmployer;

            fixture.CommitmentsApiClient
            .Setup(x => x.GetCohort(It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(fixture.Cohort);

            fixture.Source.SaveStatus = saveStatus;

            var result = await fixture.Map();

            Assert.AreEqual(expectedText, result.PageTitle);
        }
        public async Task ThenWhatHappensNextIsPopulatedCorrectly(bool isTransfer, SaveStatus saveStatus, ExpectedWhatHappensNextType expectedWhatHappensNextType)
        {
            var fixture = new WhenMappingAcknowledgementRequestToViewModelTestsFixture();

            fixture.Cohort.TransferSenderId       = isTransfer ? 100 : default(long?);
            fixture.Cohort.ChangeOfPartyRequestId = isTransfer ? default(long?) : 100;

            fixture.CommitmentsApiClient
            .Setup(x => x.GetCohort(It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(fixture.Cohort);

            fixture.Source.SaveStatus = saveStatus;

            var result = await fixture.Map();

            string[] expectedWhatHappensNext;
            switch (expectedWhatHappensNextType)
            {
            case ExpectedWhatHappensNextType.TransferFirstApproval:
                expectedWhatHappensNext = new[]
                {
                    "The employer will review the cohort and either approve or contact you with an update.",
                    "Once the employer approves the cohort, a transfer request will be sent to the funding employer to review.",
                    "You’ll receive a notification when the funding employer approves or rejects the transfer request."
                };
                break;

            case ExpectedWhatHappensNextType.EmployerWillReview:
                expectedWhatHappensNext = new[] { "The employer will review the cohort and either approve it or contact you with an update." };
                break;

            case ExpectedWhatHappensNextType.UpdatedCohort:
                expectedWhatHappensNext = new[] { "The updated cohort will appear in the employer’s account for them to review." };
                break;

            default:
                throw new NotImplementedException();
            }

            CollectionAssert.AreEquivalent(expectedWhatHappensNext, result.WhatHappensNext);
        }