public void Then_Maps_Alerts(
            GetApprenticeshipsResponse.ApprenticeshipDetailsResponse source)
        {
            var expectedAlertString = string.Empty;

            foreach (var alert in source.Alerts)
            {
                expectedAlertString += alert.GetDescription() + "|";
            }
            expectedAlertString = expectedAlertString.TrimEnd('|');

            ApprenticeshipDetailsCsvModel result = source;

            result.Alerts.Should().Be(expectedAlertString);
        }
        public void Then_Maps_Alerts(
            GetApprenticeshipsResponse.ApprenticeshipDetailsResponse source,
            [Frozen] Mock <IEncodingService> encodingService,
            ApprenticeshipDetailsCsvModel model)
        {
            var expectedAlertString = string.Empty;

            foreach (var alert in source.Alerts)
            {
                expectedAlertString += alert.GetDescription() + "|";
            }
            expectedAlertString = expectedAlertString.TrimEnd('|');

            var result = model.Map(source, encodingService.Object);

            result.Alerts.Should().Be(expectedAlertString);
        }
Beispiel #3
0
 public ApprenticeshipDetailsCsvModel Map(GetApprenticeshipsResponse.ApprenticeshipDetailsResponse model, IEncodingService encodingService)
 {
     return(new ApprenticeshipDetailsCsvModel
     {
         ApprenticeName = $"{model.FirstName} {model.LastName}",
         Uln = model.Uln,
         Employer = model.EmployerName,
         CourseName = model.CourseName,
         PlannedStartDate = model.StartDate.ToGdsFormatWithoutDay(),
         PlannedEndDate = model.EndDate.ToGdsFormatWithoutDay(),
         Status = model.ApprenticeshipStatus.GetDescription(),
         Alerts = GenerateAlerts(model.Alerts),
         ProviderRef = model.ProviderRef,
         CohortReference = model.CohortReference,
         AgreementId = encodingService.Encode(model.AccountLegalEntityId, EncodingType.PublicAccountLegalEntityId),
         DateOfBirth = model.DateOfBirth.ToGdsFormat(),
         PausedDate = model.PauseDate != DateTime.MinValue ? model.PauseDate.ToGdsFormatWithoutDay() : "",
         TotalAgreedPrice = $"{model.TotalAgreedPrice.Value as object:n0}"
     });
 }
        public void Then_Maps_DateOfBirth(GetApprenticeshipsResponse.ApprenticeshipDetailsResponse source)
        {
            ApprenticeshipDetailsCsvModel result = source;

            result.DateOfBirth.Should().Be(source.DateOfBirth.ToString("d MMM yyyy"));
        }
            public static IEnumerable <object[]> MultiplePagedProvidersTestData()
            {
                IEnumerable <GetApprenticeshipsResponse.ApprenticeshipDetailsResponse> providers = new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse[]
                {
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 1,
                        ProviderName = "A",
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 2,
                        ProviderName = "B"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 3,
                        ProviderName = "C"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 4,
                        ProviderName = "D"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 5,
                        ProviderName = "E"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 6,
                        ProviderName = "F"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 7,
                        ProviderName = "G"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 8,
                        ProviderName = "H"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 9,
                        ProviderName = "I"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 10,
                        ProviderName = "J"
                    },
                    new GetApprenticeshipsResponse.ApprenticeshipDetailsResponse()
                    {
                        ProviderId   = 11,
                        ProviderName = "K"
                    },
                };

                yield return(new object[] { providers, 10, 1, "All", "All", "ProviderName", "Asc", 11, 2 });
            }