示例#1
0
        public void DetailShouldReturnViewResultWhenStandardSearchIsSuccessful()
        {
            var searchCriteria = new ApprenticeshipProviderDetailQuery {
                StandardCode = "1", LocationId = 2, UkPrn = 3
            };

            var stubSearchResponse = Task.FromResult(new ApprenticeshipProviderDetailResponse());

            var stubProviderViewModel = new ApprenticeshipDetailsViewModel
            {
                ApprenticeshipType = ApprenticeshipTrainingType.Standard
            };

            var httpContextMock = new Mock <HttpContextBase>();
            var httpRequestMock = new Mock <HttpRequestBase>();

            httpRequestMock.Setup(m => m.UrlReferrer).Returns(new Uri("http://www.helloworld.com"));
            httpContextMock.SetupGet(c => c.Request).Returns(httpRequestMock.Object);
            var urlHelperMock = new Mock <UrlHelper>();

            urlHelperMock.Setup(m => m.Action(It.IsAny <string>(), It.IsAny <string>())).Returns(string.Empty);

            ProviderController controller = new ProviderControllerBuilder()
                                            .SetupMediator((x => x.Send(It.IsAny <ApprenticeshipProviderDetailQuery>(), default(CancellationToken))), stubSearchResponse)
                                            .SetupMappingService(x => x.Map(It.IsAny <ApprenticeshipProviderDetailResponse>(), It.IsAny <Action <IMappingOperationOptions <ApprenticeshipProviderDetailResponse, ApprenticeshipDetailsViewModel> > >()), stubProviderViewModel)
                                            .WithUrl(urlHelperMock.Object);

            var result = controller.Detail(searchCriteria).Result;

            result.Should().BeOfType <ViewResult>();

            var viewResult = (ViewResult)result;

            viewResult.Model.Should().Be(stubProviderViewModel);
        }
示例#2
0
        private static string GetNameChange(ApprenticeshipDetailsViewModel originalApprenticeship, UpdateApprenticeshipViewModel update)
        {
            var first = !string.IsNullOrWhiteSpace(update.FirstName) ? update.FirstName : originalApprenticeship.FirstName;
            var last  = !string.IsNullOrWhiteSpace(update.LastName) ? update.LastName : originalApprenticeship.LastName;

            return($"{first} {last}");
        }
        public async Task ShouldMapApiValues(
            IndexRequest request,
            GetApprenticeshipsResponse apprenticeshipsResponse,
            GetApprenticeshipsFilterValuesResponse filtersResponse,
            ApprenticeshipDetailsViewModel expectedViewModel,
            [Frozen] Mock <IModelMapper> modelMapper,
            [Frozen] Mock <ICommitmentsApiClient> mockApiClient,
            IndexViewModelMapper mapper)
        {
            //Arrange
            apprenticeshipsResponse.TotalApprenticeships =
                Constants.ApprenticesSearch.NumberOfApprenticesRequiredForSearch + 1;

            mockApiClient
            .Setup(x => x.GetApprenticeships(
                       It.IsAny <ApiRequests.GetApprenticeshipsRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(apprenticeshipsResponse);

            mockApiClient
            .Setup(client => client.GetApprenticeshipsFilterValues(
                       It.IsAny <ApiRequests.GetApprenticeshipFiltersRequest>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(filtersResponse);

            modelMapper
            .Setup(x => x.Map <ApprenticeshipDetailsViewModel>(It.IsAny <GetApprenticeshipsResponse.ApprenticeshipDetailsResponse>()))
            .ReturnsAsync(expectedViewModel);

            //Act
            var viewModel = await mapper.Map(request);

            //Assert
            Assert.IsNotNull(viewModel);
            Assert.AreEqual(request.ProviderId, viewModel.ProviderId);
            viewModel.Apprenticeships.Should().AllBeEquivalentTo(expectedViewModel);
            Assert.AreEqual(apprenticeshipsResponse.TotalApprenticeshipsFound, viewModel.FilterModel.TotalNumberOfApprenticeshipsFound);
            Assert.AreEqual(apprenticeshipsResponse.TotalApprenticeshipsWithAlertsFound, viewModel.FilterModel.TotalNumberOfApprenticeshipsWithAlertsFound);
            Assert.AreEqual(apprenticeshipsResponse.TotalApprenticeships, viewModel.FilterModel.TotalNumberOfApprenticeships);
            Assert.AreEqual(apprenticeshipsResponse.PageNumber, viewModel.FilterModel.PageNumber);
            Assert.AreEqual(request.ReverseSort, viewModel.FilterModel.ReverseSort);
            Assert.AreEqual(request.SortField, viewModel.FilterModel.SortField);
            Assert.AreEqual(filtersResponse.EmployerNames, viewModel.FilterModel.EmployerFilters);
            Assert.AreEqual(filtersResponse.CourseNames, viewModel.FilterModel.CourseFilters);
            Assert.AreEqual(filtersResponse.StartDates, viewModel.FilterModel.StartDateFilters);
            Assert.AreEqual(filtersResponse.EndDates, viewModel.FilterModel.EndDateFilters);
            Assert.AreEqual(request.SearchTerm, viewModel.FilterModel.SearchTerm);
            Assert.AreEqual(request.SelectedEmployer, viewModel.FilterModel.SelectedEmployer);
            Assert.AreEqual(request.SelectedCourse, viewModel.FilterModel.SelectedCourse);
            Assert.AreEqual(request.SelectedStatus, viewModel.FilterModel.SelectedStatus);
            Assert.AreEqual(request.SelectedStartDate, viewModel.FilterModel.SelectedStartDate);
            Assert.AreEqual(request.SelectedEndDate, viewModel.FilterModel.SelectedEndDate);
            Assert.AreEqual(request.SelectedApprenticeConfirmation, viewModel.FilterModel.SelectedApprenticeConfirmation);
        }
        public void ShouldShowAllDeliveryModesProperly()
        {
            var detail = new Detail();

            var model = new ApprenticeshipDetailsViewModel
            {
                Name = "Test name",
                EmployerSatisfactionMessage = "100%",
                LearnerSatisfactionMessage  = "100%",
                Location = new Location
                {
                    LocationId   = 1,
                    LocationName = "Test location name"
                },
                Address = new Address
                {
                    Address1 = "Address 1",
                    Address2 = "Address 2",
                    County   = "County",
                    Postcode = "PostCode",
                    Town     = "Town"
                },
                DeliveryModes = new List <string> {
                    "BlockRelease", "100PercentEmployer", "DayRelease"
                },
                ContactInformation = new ContactInformation
                {
                    ContactUsUrl = "Test contact url",
                    Email        = "Test email",
                    Website      = "Test website",
                    Phone        = "Test phone"
                },
                Apprenticeship = new ApprenticeshipBasic
                {
                    ApprenticeshipInfoUrl       = "Test apprenticeship info url",
                    ApprenticeshipMarketingInfo = "Test apprenticeship marketing info"
                },
                ProviderMarketingInfo = "Test provider marketing info",
                ApprenticeshipName    = "Test level"
            };
            var html = detail.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, ".training-structure").Should().Contain("Training options");
            GetPartial(html, ".block-release").Should().Contain("block release");
            GetPartial(html, ".block-release-absent").Should().BeEmpty();
            GetPartial(html, ".hundred-percent-employer").Should().Contain("at your location");
            GetPartial(html, ".hundred-percent-employer-absent").Should().BeEmpty();
            GetPartial(html, ".day-release").Should().Contain("day release");
            GetPartial(html, ".day-release-absent").Should().BeEmpty();
        }
        public void ShouldShowProviderLocationWhenDifferentDeliveryModesThan100PercentEmployerLocation()
        {
            var detail = new Detail();
            var model  = new ApprenticeshipDetailsViewModel
            {
                Name = "Test name",
                EmployerSatisfactionMessage = "100%",
                LearnerSatisfactionMessage  = "100%",
                Location = new Location
                {
                    LocationId   = 1,
                    LocationName = "Test location name"
                },
                Address = new Address
                {
                    Address1 = "Address 1",
                    Address2 = "Address 2",
                    County   = "County",
                    Postcode = "PostCode",
                    Town     = "Town"
                },
                LocationAddressLine = "Test location name, Address 1, Address 2",
                DeliveryModes       = new List <string> {
                    "BlockRelease"
                },
                ContactInformation = new ContactInformation
                {
                    ContactUsUrl = "Test contact url",
                    Email        = "Test email",
                    Website      = "Test website",
                    Phone        = "Test phone"
                },
                Apprenticeship = new ApprenticeshipBasic
                {
                    ApprenticeshipInfoUrl       = "Test apprenticeship info url",
                    ApprenticeshipMarketingInfo = "Test apprenticeship marketing info"
                },
                ProviderMarketingInfo = "Test provider marketing info",
                ApprenticeshipName    = "Test level"
            };
            var html = detail.RenderAsHtml(model).ToAngleSharp();

            var locationText = GetPartial(html, ".training-location");

            locationText.Should().Contain(model.Location.LocationName);
            locationText.Should().Contain(model.Address.Address1);
            locationText.Should().Contain(model.Address.Address2);
        }
        public void ShouldShowNationalProviderMessageWhenThatProviderIsAvailableAroundTheCountry()
        {
            var details = new Detail();

            var model = new ApprenticeshipDetailsViewModel
            {
                Name                        = "Test name",
                NationalProvider            = true,
                EmployerSatisfactionMessage = "no data available",
                LearnerSatisfactionMessage  = "no data available",
                Location                    = new Location
                {
                    LocationId   = 1,
                    LocationName = "Test location name"
                },
                Address = new Address
                {
                    Address1 = "Address 1",
                    Address2 = "Address 2",
                    County   = "County",
                    Postcode = "PostCode",
                    Town     = "Town"
                },
                DeliveryModes = new List <string> {
                    "BlockRelease", "100PercentEmployer", "DayRelease"
                },
                ContactInformation = new ContactInformation
                {
                    ContactUsUrl = "Test contact url",
                    Email        = "Test email",
                    Website      = "Test website",
                    Phone        = "Test phone"
                },
                Apprenticeship = new ApprenticeshipBasic
                {
                    ApprenticeshipInfoUrl       = "Test apprenticeship info url",
                    ApprenticeshipMarketingInfo = "Test apprenticeship marketing info"
                },
                ProviderMarketingInfo = "Test provider marketing info",
                ApprenticeshipName    = "Test level"
            };

            var html = details.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, ".national-message").Should().NotBeNullOrEmpty();
            GetPartial(html, ".national-message").Should().Be("National This training provider is willing to offer apprenticeship training across England.");
        }
        public void ShouldShowSourceOfSatisfactionDataIdThereIsAny()
        {
            var details = new Detail();
            var model   = new ApprenticeshipDetailsViewModel
            {
                Name = "Test name",
                EmployerSatisfactionMessage = "100%",
                LearnerSatisfactionMessage  = "100%",
                EmployerSatisfaction        = 12,
                LearnerSatisfaction         = 45,
                Location = new Location
                {
                    LocationId   = 1,
                    LocationName = "Test location name"
                },
                Address = new Address
                {
                    Address1 = "Address 1",
                    Address2 = "Address 2",
                    County   = "County",
                    Postcode = "PostCode",
                    Town     = "Town"
                },
                DeliveryModes = new List <string> {
                    "BlockRelease", "100PercentEmployer", "DayRelease"
                },
                ContactInformation = new ContactInformation
                {
                    ContactUsUrl = "Test contact url",
                    Email        = "Test email",
                    Website      = "Test website",
                    Phone        = "Test phone"
                },
                Apprenticeship = new ApprenticeshipBasic
                {
                    ApprenticeshipInfoUrl       = "Test apprenticeship info url",
                    ApprenticeshipMarketingInfo = "Test apprenticeship marketing info"
                },
                ProviderMarketingInfo = "Test provider marketing info",
                ApprenticeshipName    = "Test level"
            };

            var html = details.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, ".satisfaction-source").Should().Contain("Source:");
        }
示例#8
0
        public async Task ShouldMapStatusValues(
            IndexRequest request,
            GetApprenticeshipsResponse apprenticeshipsResponse,
            GetApprenticeshipsFilterValuesResponse filtersResponse,
            ApprenticeshipDetailsViewModel expectedViewModel,
            [Frozen]
            Mock <IMapper <GetApprenticeshipsResponse.ApprenticeshipDetailsResponse, ApprenticeshipDetailsViewModel> >
            detailsViewModelMapper,
            [Frozen] Mock <ICommitmentsApiClient> mockApiClient,
            IndexViewModelMapper mapper)
        {
            //Arrange
            apprenticeshipsResponse.TotalApprenticeships =
                Constants.ApprenticesSearch.NumberOfApprenticesRequiredForSearch + 1;

            mockApiClient
            .Setup(x => x.GetApprenticeships(
                       It.IsAny <ApiRequests.GetApprenticeshipsRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(apprenticeshipsResponse);

            mockApiClient
            .Setup(client => client.GetApprenticeshipsFilterValues(
                       It.IsAny <ApiRequests.GetApprenticeshipFiltersRequest>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(filtersResponse);

            detailsViewModelMapper
            .Setup(x => x.Map(It.IsAny <GetApprenticeshipsResponse.ApprenticeshipDetailsResponse>()))
            .ReturnsAsync(expectedViewModel);

            //Act
            var viewModel = await mapper.Map(request);

            Assert.IsTrue(viewModel.FilterModel.StatusFilters.Contains(ApprenticeshipStatus.Live));
            Assert.IsTrue(viewModel.FilterModel.StatusFilters.Contains(ApprenticeshipStatus.Paused));
            Assert.IsTrue(viewModel.FilterModel.StatusFilters.Contains(ApprenticeshipStatus.Stopped));
            Assert.IsTrue(viewModel.FilterModel.StatusFilters.Contains(ApprenticeshipStatus.WaitingToStart));
            Assert.IsTrue(viewModel.FilterModel.StatusFilters.Contains(ApprenticeshipStatus.Completed));
            Assert.IsFalse(viewModel.FilterModel.StatusFilters.Contains(ApprenticeshipStatus.Unknown));
        }
示例#9
0
        public async Task ThenWillSetPageNumberToLastOneIfRequestPageNumberIsTooHigh(
            IndexRequest request,
            GetApprenticeshipsResponse apprenticeshipsResponse,
            GetApprenticeshipsFilterValuesResponse filtersResponse,
            ApprenticeshipDetailsViewModel expectedViewModel,
            [Frozen]
            Mock <IMapper <GetApprenticeshipsResponse.ApprenticeshipDetailsResponse, ApprenticeshipDetailsViewModel> >
            detailsViewModelMapper,
            [Frozen] Mock <ICommitmentsApiClient> mockApiClient,
            IndexViewModelMapper mapper)
        {
            //Arrange
            apprenticeshipsResponse.PageNumber = (int)Math.Ceiling((double)apprenticeshipsResponse.TotalApprenticeshipsFound / Constants.ApprenticesSearch.NumberOfApprenticesPerSearchPage);
            request.PageNumber = apprenticeshipsResponse.PageNumber + 10;

            apprenticeshipsResponse.TotalApprenticeships =
                Constants.ApprenticesSearch.NumberOfApprenticesRequiredForSearch + 1;

            mockApiClient
            .Setup(x => x.GetApprenticeships(
                       It.IsAny <ApiRequests.GetApprenticeshipsRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(apprenticeshipsResponse);

            mockApiClient
            .Setup(client => client.GetApprenticeshipsFilterValues(
                       It.IsAny <ApiRequests.GetApprenticeshipFiltersRequest>(),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(filtersResponse);

            detailsViewModelMapper
            .Setup(x => x.Map(It.IsAny <GetApprenticeshipsResponse.ApprenticeshipDetailsResponse>()))
            .ReturnsAsync(expectedViewModel);

            //Act
            var viewModel = await mapper.Map(request);

            //Assert
            Assert.AreEqual(1, viewModel.FilterModel.PageLinks.Count(x => x.IsCurrent.HasValue && x.IsCurrent.Value));
            Assert.IsTrue(viewModel.FilterModel.PageLinks.Last().IsCurrent);
        }
        public void ShouldNotShowMoreInformationLinkWhenThereIsNoProviderAchivementValue()
        {
            var details = new Detail();
            var model   = new ApprenticeshipDetailsViewModel
            {
                AchievementRateMessage = "no data available",
                Location = new Location
                {
                    LocationId   = 1,
                    LocationName = "Test location name"
                },
                Address = new Address
                {
                    Address1 = "Address 1",
                    Address2 = "Address 2",
                    County   = "County",
                    Postcode = "PostCode",
                    Town     = "Town"
                },
                DeliveryModes = new List <string> {
                    "BlockRelease", "100PercentEmployer", "DayRelease"
                },
                ContactInformation = new ContactInformation
                {
                    ContactUsUrl = "Test contact url",
                    Email        = "Test email",
                    Website      = "Test website",
                    Phone        = "Test phone"
                },
                Apprenticeship = new ApprenticeshipBasic
                {
                    ApprenticeshipInfoUrl       = "Test apprenticeship info url",
                    ApprenticeshipMarketingInfo = "Test apprenticeship marketing info"
                }
            };

            var html = details.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, ".more-information").Should().BeNullOrEmpty();
        }
        public void ShouldShowAllFieldsWhenEverythingIsOk()
        {
            var detail = new Detail();

            var model = new ApprenticeshipDetailsViewModel
            {
                Name      = "Test name",
                LegalName = "Legal Test Name",
                EmployerSatisfactionMessage = "100%",
                LearnerSatisfactionMessage  = "100%",
                Location = new Location
                {
                    LocationId   = 1,
                    LocationName = "Test location name"
                },
                Address = new Address
                {
                    Address1 = "Address 1",
                    Address2 = "Address 2",
                    County   = "County",
                    Postcode = "PostCode",
                    Town     = "Town"
                },
                LocationAddressLine = "Test location name, Address 1, Address 2, Town, County, PostCode",
                DeliveryModes       = new List <string> {
                    "BlockRelease"
                },
                ContactInformation = new ContactInformation
                {
                    ContactUsUrl = "http://www.testcontact.url",
                    Email        = "Test email",
                    Website      = "Test website",
                    Phone        = "Test phone"
                },
                Apprenticeship = new ApprenticeshipBasic
                {
                    ApprenticeshipInfoUrl       = "www.test-apprenticeship.info.url",
                    ApprenticeshipMarketingInfo = "Test apprenticeship marketing info"
                },
                ProviderMarketingInfo = "Test provider marketing info",
                ApprenticeshipName    = "Test level"
            };
            var html = detail.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, ".apprenticeshipContactTitle").Should().Contain("Website");
            GetPartial(html, ".apprenticeshipContact").Should().Contain("Test name website");
            GetAttribute(html, ".apprenticeshipContact", "href").Should().Be("http://www.test-apprenticeship.info.url", "because http be added if missing");
            GetPartial(html, ".providerContactTitle").Should().Contain("Contact page");
            GetPartial(html, ".providerContact").Should().Contain("contact this training provider");
            GetAttribute(html, ".providerContact", "href").Should().Be("http://www.testcontact.url", "http should only be added once");

            GetPartial(html, ".legal-name").Should().Contain("Legal Test Name");
            GetPartial(html, ".phone-title").Should().Contain("Phone");
            GetPartial(html, ".phone").Should().Contain(model.ContactInformation.Phone);
            GetPartial(html, ".email-title").Should().Contain("Email");
            GetPartial(html, ".email").Should().Contain(model.ContactInformation.Email);
            GetPartial(html, ".training-structure").Should().Contain("Training options");
            GetPartial(html, ".block-release").Should().Contain("block release");
            GetPartial(html, ".block-release-absent").Should().BeEmpty();
            GetPartial(html, ".hundred-percent-employer").Should().BeEmpty();
            GetPartial(html, ".hundred-percent-employer-absent").Should().Contain("at your location");
            GetPartial(html, ".day-release").Should().BeEmpty();
            GetPartial(html, ".day-release-absent").Should().Contain("day release");
            GetPartial(html, ".training-location-title").Should().Contain("Address");
            GetPartial(html, ".training-location").Should().Contain("Test location name, Address 1, Address 2, Town, County, PostCode");
        }
        public ApprenticeshipDetailsViewModel MapToApprenticeshipDetailsViewModel(Apprenticeship apprenticeship, bool disableUlnReuseCheck = false)
        {
            var pendingChange = PendingChanges.None;

            if (apprenticeship.PendingUpdateOriginator == Originator.Employer)
            {
                pendingChange = PendingChanges.WaitingForApproval;
            }
            if (apprenticeship.PendingUpdateOriginator == Originator.Provider)
            {
                pendingChange = PendingChanges.ReadyForApproval;
            }

            var statusText                      = MapPaymentStatus(apprenticeship.PaymentStatus, apprenticeship.StartDate);
            var hashedAccountId                 = _hashingService.HashValue(apprenticeship.EmployerAccountId);
            var hashedApprenticeshipId          = _hashingService.HashValue(apprenticeship.Id);
            var pendingChangeOfProviderRequest  = apprenticeship.ChangeOfPartyRequests?.Where(x => x.ChangeOfPartyType == ChangeOfPartyRequestType.ChangeProvider && x.Status == ChangeOfPartyRequestStatus.Pending).FirstOrDefault();
            var approvedChangeOfProviderRequest = apprenticeship.ChangeOfPartyRequests?.Where(x => x.ChangeOfPartyType == ChangeOfPartyRequestType.ChangeProvider && x.Status == ChangeOfPartyRequestStatus.Approved).FirstOrDefault();
            var pendingChangeOfEmployerRequest  = apprenticeship.ChangeOfPartyRequests?.Where(x => x.ChangeOfPartyType == ChangeOfPartyRequestType.ChangeEmployer && x.Status == ChangeOfPartyRequestStatus.Pending).FirstOrDefault();
            var approvedChangeOfEmployerRequest = apprenticeship.ChangeOfPartyRequests?.Where(x => x.ChangeOfPartyType == ChangeOfPartyRequestType.ChangeEmployer && x.Status == ChangeOfPartyRequestStatus.Approved).FirstOrDefault();

            var result = new ApprenticeshipDetailsViewModel
            {
                HashedApprenticeshipId = hashedApprenticeshipId,
                FirstName      = apprenticeship.FirstName,
                LastName       = apprenticeship.LastName,
                ULN            = apprenticeship.ULN,
                DateOfBirth    = apprenticeship.DateOfBirth,
                StartDate      = apprenticeship.StartDate,
                EndDate        = apprenticeship.EndDate,
                StopDate       = apprenticeship.StopDate,
                PauseDate      = apprenticeship.PauseDate,
                CompletionDate = apprenticeship.CompletionDate,
                TrainingName   = apprenticeship.TrainingName,
                Cost           = apprenticeship.Cost,
                PaymentStatus  = apprenticeship.PaymentStatus,
                Status         = statusText,
                ProviderName   = apprenticeship.ProviderName,
                PendingChanges = pendingChange,
                Alerts         = MapRecordStatus(apprenticeship.PendingUpdateOriginator,
                                                 apprenticeship.DataLockCourseTriaged,
                                                 apprenticeship.DataLockPriceTriaged || apprenticeship.DataLockCourseChangeTriaged),
                EmployerReference = apprenticeship.EmployerRef,
                CohortReference   = _hashingService.HashValue(apprenticeship.CommitmentId),
                EnableEdit        = pendingChange == PendingChanges.None &&
                                    !apprenticeship.DataLockCourseTriaged &&
                                    !apprenticeship.DataLockCourseChangeTriaged &&
                                    !apprenticeship.DataLockPriceTriaged &&
                                    new [] { PaymentStatus.Active, PaymentStatus.Paused }.Contains(apprenticeship.PaymentStatus),
                CanEditStatus        = !(new List <PaymentStatus> {
                    PaymentStatus.Completed, PaymentStatus.Withdrawn
                }).Contains(apprenticeship.PaymentStatus),
                CanEditStopDate      = (apprenticeship.PaymentStatus == PaymentStatus.Withdrawn),
                EndpointAssessorName = apprenticeship.EndpointAssessorName,
                TrainingType         = apprenticeship.TrainingType,
                ReservationId        = apprenticeship.ReservationId,
                MadeRedundant        = apprenticeship.MadeRedundant,
                ChangeProviderLink   = GetChangeOfProviderLink(hashedAccountId, hashedApprenticeshipId),
                HasPendingChangeOfProviderRequest       = pendingChangeOfProviderRequest != null,
                PendingChangeOfProviderRequestWithParty = pendingChangeOfProviderRequest?.WithParty,
                HasApprovedChangeOfProviderRequest      = approvedChangeOfProviderRequest != null,
                HashedNewApprenticeshipId = approvedChangeOfProviderRequest?.NewApprenticeshipId != null
                        ? _hashingService.HashValue(approvedChangeOfProviderRequest.NewApprenticeshipId.Value)
                        :null,
                IsContinuation = apprenticeship.ContinuationOfId.HasValue,
                IsChangeOfProviderContinuation = apprenticeship.IsChangeOfProviderContinuation,
                HashedPreviousApprenticeshipId = apprenticeship.ContinuationOfId.HasValue
                        ? _hashingService.HashValue(apprenticeship.ContinuationOfId.Value)
                        : null,
                HasPendingChangeOfEmployerRequest       = pendingChangeOfEmployerRequest != null,
                PendingChangeOfEmployerRequestWithParty = pendingChangeOfEmployerRequest?.WithParty,
                HasApprovedChangeOfEmployerRequest      = approvedChangeOfEmployerRequest != null
            };

            return(result);
        }