public AppsIndicativeEarningsReportModel BuildLineModel(
            ILearner learner,
            ILearningDelivery learningDelivery,
            LearningDelivery fm36DeliveryAttribute,
            PriceEpisode fm36EpisodeAttribute,
            LARSLearningDelivery larsLearningDelivery,
            string notionalEndLevel,
            bool earliestEpisode,
            bool hasPriceEpisodes)
        {
            DateTime employmentStatusDate = learner.LearnerEmploymentStatuses?
                                            .Where(x => x.DateEmpStatApp <= learningDelivery.LearnStartDate).Select(x => x.DateEmpStatApp)
                                            .DefaultIfEmpty(DateTime.MinValue).Max() ?? DateTime.MinValue;

            var model = new AppsIndicativeEarningsReportModel
            {
                Learner = learner,
                ProviderSpecLearnerMonitoring =
                    _ilrModelMapper.MapProviderSpecLearnerMonitorings(learner.ProviderSpecLearnerMonitorings),
                ProviderSpecDeliveryMonitoring =
                    _ilrModelMapper.MapProviderSpecDeliveryMonitorings(learningDelivery
                                                                       .ProviderSpecDeliveryMonitorings),
                LearningDeliveryFAMs = _ilrModelMapper.MapLearningDeliveryFAMs(learningDelivery.LearningDeliveryFAMs),
                LearningDelivery     = learningDelivery,
                LarsLearningDelivery = larsLearningDelivery,
                EmploymentStatus     =
                    learner.LearnerEmploymentStatuses?.SingleOrDefault(x => x.DateEmpStatApp == employmentStatusDate),
                PriceEpisodeValues       = fm36EpisodeAttribute?.PriceEpisodeValues,
                StandardNotionalEndLevel = notionalEndLevel
            };

            model.EmpStatusMonitoringSmallEmployer = model.EmploymentStatus?.EmploymentStatusMonitorings
                                                     ?.FirstOrDefault(x => string.Equals(x.ESMType, ReportingConstants.EmploymentStatusMonitoringTypeSEM,
                                                                                         StringComparison.OrdinalIgnoreCase))?.ESMCode;
            model.FundingLineType      = GetFundingType(fm36DeliveryAttribute?.LearningDeliveryValues, fm36EpisodeAttribute?.PriceEpisodeValues);
            model.Fm36LearningDelivery = fm36DeliveryAttribute?.LearningDeliveryValues;

            if (learningDelivery?.LearningDeliveryFAMs != null)
            {
                CalculateApprenticeshipContractTypeFields(
                    learningDelivery,
                    model,
                    fm36DeliveryAttribute,
                    fm36EpisodeAttribute,
                    hasPriceEpisodes);
            }

            if (earliestEpisode || !hasPriceEpisodes)
            {
                CalculateAppFinTotals(model, learningDelivery);
            }

            var isMathsEngLearningDelivery = fm36DeliveryAttribute?.LearningDeliveryValues?.LearnDelMathEng ?? false;

            model.PeriodisedValues = BuildPeriodisedValuesModel(fm36EpisodeAttribute?.PriceEpisodePeriodisedValues,
                                                                fm36DeliveryAttribute?.LearningDeliveryPeriodisedValues, isMathsEngLearningDelivery);
            return(model);
        }
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsRefererenceDataServiceMock    = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();

            var learner = new ALBLearnerDto
            {
                LearnRefNumber     = "Learner1",
                LearningDeliveries = new List <LearningDelivery>
                {
                    new LearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        PwayCode             = 5,
                        ProgType             = 6,
                        FworkCode            = 7,
                        FundModel            = 99,
                        StdCode              = 8,
                        LearnStartDate       = new DateTime(2019, 8, 1),
                        LearnPlanEndDate     = new DateTime(2020, 8, 1),
                        DelLocPostCode       = "Postcode",
                        LearningDeliveryFAMs = new List <LearningDeliveryFAM>
                        {
                            new LearningDeliveryFAM()
                        },
                    }
                }
            };

            var larsFunding = new List <LARSFunding>
            {
                new LARSFunding()
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                LARSFundings = larsFunding
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(new List <SfaAreaCost> {
                new SfaAreaCost()
            });

            return(new DataEntityMapper(
                       larsRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
        public void LARSLearningDeliveryForLearnAimRef()
        {
            var learnAimRef      = "learnAimRef";
            var learningDelivery = new LARSLearningDelivery();

            var referenceDataCacheMock = new Mock <IExternalDataCache>();

            referenceDataCacheMock.SetupGet(rdc => rdc.LARSLearningDelivery)
            .Returns(
                new Dictionary <string, LARSLearningDelivery>()
            {
                { learnAimRef, learningDelivery }
            });

            NewService(referenceDataCacheMock.Object).LARSLearningDeliveryForLearnAimRef(learnAimRef).Should().Be(learningDelivery);
        }
Beispiel #4
0
 private AimAndDeliverableReportRow BuildRow(
     LearningDelivery learningDelivery,
     DPOutcome dpOutcome,
     ESFDPOutcome esfDpOutcome,
     LARSLearningDelivery larsLearningDelivery,
     FCSDeliverableCodeMapping fcsDeliverableCodeMapping,
     ESFLearningDeliveryDeliverablePeriod deliverablePeriod = null,
     string reportMonth = null)
 => new AimAndDeliverableReportRow()
 {
     LearningDelivery          = learningDelivery,
     DPOutcome                 = dpOutcome,
     ESFDPOutcome              = esfDpOutcome,
     LarsLearningDelivery      = larsLearningDelivery,
     DeliverablePeriod         = deliverablePeriod,
     FcsDeliverableCodeMapping = fcsDeliverableCodeMapping,
     ReportMonth               = reportMonth,
 };
Beispiel #5
0
        public void BuildLearningDelivery()
        {
            var learningDelivery = new TestLearningDelivery()
            {
                AimSeqNumber            = 1,
                AimType                 = 2,
                CompStatus              = 3,
                FundModel               = 4,
                LearnActEndDateNullable = new DateTime(2017, 1, 1),
                LearnAimRef             = "LearnAimRef",
                LearnPlanEndDate        = new DateTime(2018, 1, 1),
                LearnStartDate          = new DateTime(2019, 1, 1),
                ProgTypeNullable        = 7,
                WithdrawReasonNullable  = 8,
                LearningDeliveryFAMs    = new List <TestLearningDeliveryFAM>()
                {
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "SOF", LearnDelFAMCode = "SOF"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM1"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM2"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM3"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM4"
                    },
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery()
            {
                AwardOrgCode           = "awardOrgCode",
                EFACOFType             = 1,
                LearnAimRefTitle       = "learnAimRefTitle",
                LearnAimRefType        = "learnAimRefType",
                SectorSubjectAreaTier2 = 1.0m
            };

            var larsReferenceDataServiceMock = new Mock <ILARSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);

            var dataEntity = NewService(larsReferenceDataServiceMock.Object).BuildLearningDeliveryDataEntity(learningDelivery);

            dataEntity.EntityName.Should().Be("LearningDelivery");
            dataEntity.Attributes.Should().HaveCount(20);
            dataEntity.Attributes["AimSeqNumber"].Value.Should().Be(learningDelivery.AimSeqNumber);
            dataEntity.Attributes["AimType"].Value.Should().Be(learningDelivery.AimType);
            dataEntity.Attributes["AwardOrgCode"].Value.Should().Be(larsLearningDelivery.AwardOrgCode);
            dataEntity.Attributes["CompStatus"].Value.Should().Be(learningDelivery.CompStatus);
            dataEntity.Attributes["EFACOFType"].Value.Should().Be(larsLearningDelivery.EFACOFType);
            dataEntity.Attributes["FundModel"].Value.Should().Be(learningDelivery.FundModel);
            dataEntity.Attributes["LearnActEndDate"].Value.Should().Be(learningDelivery.LearnActEndDateNullable);
            dataEntity.Attributes["LearnAimRef"].Value.Should().Be(learningDelivery.LearnAimRef);
            dataEntity.Attributes["LearnAimRefTitle"].Value.Should().Be(larsLearningDelivery.LearnAimRefTitle);
            dataEntity.Attributes["LearnAimRefType"].Value.Should().Be(larsLearningDelivery.LearnAimRefType);
            dataEntity.Attributes["LearnPlanEndDate"].Value.Should().Be(learningDelivery.LearnPlanEndDate);
            dataEntity.Attributes["LearnStartDate"].Value.Should().Be(learningDelivery.LearnStartDate);
            dataEntity.Attributes["LrnDelFAM_SOF"].Value.Should().Be("SOF");
            dataEntity.Attributes["LrnDelFAM_LDM1"].Value.Should().Be("LDM1");
            dataEntity.Attributes["LrnDelFAM_LDM2"].Value.Should().Be("LDM2");
            dataEntity.Attributes["LrnDelFAM_LDM3"].Value.Should().Be("LDM3");
            dataEntity.Attributes["LrnDelFAM_LDM4"].Value.Should().Be("LDM4");
            dataEntity.Attributes["ProgType"].Value.Should().Be(learningDelivery.ProgTypeNullable);
            dataEntity.Attributes["SectorSubjectAreaTier2"].Value.Should().Be(larsLearningDelivery.SectorSubjectAreaTier2);
            dataEntity.Attributes["WithdrawReason"].Value.Should().Be(learningDelivery.WithdrawReasonNullable);
        }
Beispiel #6
0
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsReferenceDataServiceMock = new Mock <ILARSReferenceDataService>();

            var learner = new FM81LearnerDto
            {
                LearnRefNumber            = "Learner1",
                LearnerEmploymentStatuses = new List <LearnerEmploymentStatus>
                {
                    new LearnerEmploymentStatus
                    {
                        EmpId          = 10,
                        DateEmpStatApp = new DateTime(2019, 8, 1),
                        EmpStat        = 2,
                    },
                },
                LearningDeliveries = new List <LearningDelivery>
                {
                    new LearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        PwayCode             = 5,
                        ProgType             = 25,
                        FworkCode            = 7,
                        FundModel            = 81,
                        StdCode              = 8,
                        LearnStartDate       = new DateTime(2019, 8, 1),
                        LearnPlanEndDate     = new DateTime(2020, 8, 1),
                        DelLocPostCode       = "Postcode",
                        LearningDeliveryFAMs = new List <LearningDeliveryFAM>
                        {
                            new LearningDeliveryFAM()
                        },
                        AppFinRecords = new List <AppFinRecord>
                        {
                            new AppFinRecord()
                        }
                    },
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                LARSFundings = new List <LARSFunding>
                {
                    new LARSFunding(),
                },
            };

            var larsStandardCmnCmpnt = new List <LARSStandardCommonComponent>
            {
                new LARSStandardCommonComponent()
            };

            var larsStandardFunding = new List <LARSStandardFunding>
            {
                new LARSStandardFunding()
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsReferenceDataServiceMock.Setup(l => l.LARSStandardForStandardCode(learningDelivery.StdCode))
            .Returns(
                new LARSStandard
            {
                LARSStandardCommonComponents = larsStandardCmnCmpnt,
                LARSStandardFundings         = larsStandardFunding
            });

            return(new DataEntityMapper(larsReferenceDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
        public IEnumerable <AppsIndicativeEarningsReportModel> Build(IReportServiceContext reportServiceContext, IReportServiceDependentData reportServiceDependentData)
        {
            var message  = reportServiceDependentData.Get <IMessage>();
            var fm36Data = reportServiceDependentData.Get <FM36Global>();
            var appsIndicativeEarningsModels = new List <AppsIndicativeEarningsReportModel>();
            var referenceData = reportServiceDependentData.Get <ReferenceDataRoot>();
            IDictionary <string, LARSLearningDelivery> larsLearningDeliveries = BuildLarsLearningDeliveryDictionary(referenceData);
            IDictionary <int, LARSStandard>            larsStandards          = BuildLarsStandardDictionary(referenceData);
            IDictionary <string, FM36Learner>          fm36Learners           = BuildFm36LearnerDeliveryDictionary(fm36Data);

            foreach (var learner in message?.Learners?.Where(l => l != null) ?? Enumerable.Empty <ILearner>())
            {
                FM36Learner fm36Learner = fm36Learners.GetValueOrDefault(learner.LearnRefNumber);

                foreach (var learningDelivery in learner.LearningDeliveries ?? Enumerable.Empty <ILearningDelivery>())
                {
                    if (learningDelivery.FundModel != FundModelConstants.FM36)
                    {
                        continue;
                    }

                    LARSLearningDelivery larsDelivery         = larsLearningDeliveries.GetValueOrDefault(learningDelivery.LearnAimRef);
                    LearningDelivery     fm36LearningDelivery = fm36Learner?.LearningDeliveries?.FirstOrDefault(x => x.AimSeqNumber == learningDelivery.AimSeqNumber);
                    string larsStandard = null;

                    if (learningDelivery.StdCodeNullable != null)
                    {
                        larsStandard = larsStandards.GetValueOrDefault(learningDelivery.StdCodeNullable.Value)?.NotionalEndLevel ?? "NA";
                    }

                    if (fm36Learner?.PriceEpisodes.Any() ?? false)
                    {
                        List <PriceEpisode> episodesInRange = fm36Learner.PriceEpisodes
                                                              .Where(p => p.PriceEpisodeValues.EpisodeStartDate >= ReportingConstants.BeginningOfYear &&
                                                                     p.PriceEpisodeValues.EpisodeStartDate <= ReportingConstants.EndOfYear &&
                                                                     learningDelivery.AimSeqNumber == p.PriceEpisodeValues.PriceEpisodeAimSeqNumber)
                                                              .ToList();

                        if (episodesInRange.Any())
                        {
                            DateTime earliestEpisodeDate = episodesInRange.Select(x => x.PriceEpisodeValues.EpisodeStartDate ?? DateTime.MaxValue).Min();

                            foreach (PriceEpisode episodeAttribute in episodesInRange)
                            {
                                appsIndicativeEarningsModels.Add(BuildLineModel(learner,
                                                                                learningDelivery,
                                                                                fm36LearningDelivery,
                                                                                episodeAttribute,
                                                                                larsDelivery,
                                                                                larsStandard,
                                                                                episodeAttribute.PriceEpisodeValues.EpisodeStartDate == earliestEpisodeDate,
                                                                                true));
                            }
                            continue;
                        }
                    }

                    appsIndicativeEarningsModels.Add(BuildLineModel(learner,
                                                                    learningDelivery,
                                                                    fm36LearningDelivery,
                                                                    null,
                                                                    larsDelivery,
                                                                    larsStandard,
                                                                    false,
                                                                    false));
                }
            }

            return(appsIndicativeEarningsModels
                   .OrderBy(x => x.LearnRefNumber)
                   .ThenByDescending(x => x.AimSeqNumber)
                   .ThenByDescending(x => x.PriceEpisodeStartDate));
        }
        public void BuildLearningDelivery()
        {
            var learningDelivery = new TestLearningDelivery()
            {
                AimSeqNumber               = 1,
                AimType                    = 2,
                CompStatus                 = 3,
                ConRefNumber               = "ConRef1",
                DelLocPostCode             = "DelLocPostcode",
                FundModel                  = 4,
                FworkCodeNullable          = 5,
                LearnActEndDateNullable    = new DateTime(2017, 1, 1),
                LearnAimRef                = "LearnAimRef",
                LearnPlanEndDate           = new DateTime(2018, 1, 1),
                LearnStartDate             = new DateTime(2019, 1, 1),
                OrigLearnStartDateNullable = new DateTime(2019, 1, 1),
                OtherFundAdjNullable       = 6,
                OutcomeNullable            = 7,
                PriorLearnFundAdjNullable  = 8,
                LearningDeliveryFAMs       = new List <TestLearningDeliveryFAM>()
                {
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM1"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM2"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM3"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM4"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "RES", LearnDelFAMCode = "RES"
                    },
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode             = "awardOrgCode",
                EFACOFType               = 1,
                FrameworkCommonComponent = 2,
                LearnAimRefTitle         = "learnAimRefTitle",
                LearnAimRefType          = "learnAimRefType",
                RegulatedCreditValue     = 3,
                NotionalNVQLevelv2       = "NVQLevel",
                LearningDeliveryGenre    = "Genre",
                LARSFunding              = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2018, 1, 1),
                        EffectiveTo     = new DateTime(2019, 1, 1),
                    },
                },
            };

            var fcsContract = new List <FCSContractAllocation>
            {
                new FCSContractAllocation
                {
                    CalcMethod = 1,
                    FCSContractDeliverables = new List <FCSContractDeliverable>
                    {
                        new FCSContractDeliverable()
                    }
                }
            };

            var larsReferenceDataServiceMock      = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();
            var fcsReferenceDataMock = new Mock <IFCSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsReferenceDataServiceMock.Setup(l => l.LARSAnnualValuesForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSAnnualValue> {
                new LARSAnnualValue()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(new List <SfaAreaCost> {
                new SfaAreaCost()
            });
            fcsReferenceDataMock.Setup(f => f.FcsContractsForConRef(learningDelivery.ConRefNumber)).Returns(fcsContract);

            var dataEntity = NewService(
                fcsReferenceDataService: fcsReferenceDataMock.Object,
                larsReferenceDataService: larsReferenceDataServiceMock.Object,
                postcodesReferenceDataService: postcodesReferenceDataServiceMock.Object)
                             .BuildLearningDeliveryDataEntity(learningDelivery);

            dataEntity.EntityName.Should().Be("LearningDelivery");
            dataEntity.Attributes.Should().HaveCount(20);
            dataEntity.Attributes["AchDate"].Value.Should().Be(learningDelivery.AchDateNullable);
            dataEntity.Attributes["AddHours"].Value.Should().Be(learningDelivery.AddHoursNullable);
            dataEntity.Attributes["AimSeqNumber"].Value.Should().Be(learningDelivery.AimSeqNumber);
            dataEntity.Attributes["CalcMethod"].Value.Should().Be(1);
            dataEntity.Attributes["CompStatus"].Value.Should().Be(learningDelivery.CompStatus);
            dataEntity.Attributes["ConRefNumber"].Value.Should().Be(learningDelivery.ConRefNumber);
            dataEntity.Attributes["GenreCode"].Value.Should().Be(larsLearningDelivery.LearningDeliveryGenre);
            dataEntity.Attributes["LearnActEndDate"].Value.Should().Be(learningDelivery.LearnActEndDateNullable);
            dataEntity.Attributes["LearnAimRef"].Value.Should().Be(learningDelivery.LearnAimRef);
            dataEntity.Attributes["LearnPlanEndDate"].Value.Should().Be(learningDelivery.LearnPlanEndDate);
            dataEntity.Attributes["LearnStartDate"].Value.Should().Be(learningDelivery.LearnStartDate);
            dataEntity.Attributes["LrnDelFAM_LDM1"].Value.Should().Be("LDM1");
            dataEntity.Attributes["LrnDelFAM_LDM2"].Value.Should().Be("LDM2");
            dataEntity.Attributes["LrnDelFAM_LDM3"].Value.Should().Be("LDM3");
            dataEntity.Attributes["LrnDelFAM_LDM4"].Value.Should().Be("LDM4");
            dataEntity.Attributes["LrnDelFAM_RES"].Value.Should().Be("RES");
            dataEntity.Attributes["OrigLearnStartDate"].Value.Should().Be(learningDelivery.OrigLearnStartDateNullable);
            dataEntity.Attributes["OtherFundAdj"].Value.Should().Be(learningDelivery.OtherFundAdjNullable);
            dataEntity.Attributes["Outcome"].Value.Should().Be(learningDelivery.OutcomeNullable);
            dataEntity.Attributes["PriorLearnFundAdj"].Value.Should().Be(learningDelivery.PriorLearnFundAdjNullable);
        }
Beispiel #9
0
        public void MapTo()
        {
            var ukprn          = 1;
            var learnAimRef    = "LearnAimRef";
            var delLocPostCode = "Postcode";
            var stdCode        = 1;

            var larsVersion      = "1.0.0";
            var year             = "2021";
            var collectionPeriod = "DefaultPeriod";

            var global = new Global
            {
                LARSVersion      = larsVersion,
                UKPRN            = ukprn,
                Year             = year,
                CollectionPeriod = collectionPeriod
            };

            var learnerDtos = new List <FM36LearnerDto>
            {
                new FM36LearnerDto
                {
                    ULN = 1,
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef    = learnAimRef,
                            DelLocPostCode = delLocPostCode,
                            FundModel      = 36,
                            StdCode        = stdCode
                        }
                    }
                },
                new FM36LearnerDto
                {
                    ULN = 1,
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef    = learnAimRef,
                            DelLocPostCode = delLocPostCode,
                            FundModel      = 36,
                            StdCode        = stdCode
                        }
                    }
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode         = "awardOrgCode",
                EFACOFType           = 1,
                LearnAimRefTitle     = "learnAimRefTitle",
                LearnAimRefType      = "learnAimRefType",
                RegulatedCreditValue = 2,
                NotionalNVQLevelv2   = "NVQLevel",
                LARSFundings         = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2019, 1, 1),
                        EffectiveTo     = new DateTime(2020, 1, 1),
                    }
                }
            };

            var larsStandard = new LARSStandard
            {
                StandardCode = 1,
            };

            IEnumerable <DasDisadvantage> dasDisadvantage = new List <DasDisadvantage>
            {
                new DasDisadvantage
                {
                    Postcode      = "DelLocPostcode",
                    EffectiveFrom = new DateTime(2019, 1, 1),
                    EffectiveTo   = new DateTime(2020, 1, 1),
                    Uplift        = 1.2m
                }
            };

            var postcodesRefererenceDataServiceMock   = new Mock <IPostcodesReferenceDataService>();
            var appsHistoryRefererenceDataServiceMock = new Mock <IAppsEarningsHistoryReferenceDataService>();
            var larsReferenceDataServiceMock          = new Mock <ILARSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSCurrentVersion()).Returns(global.LARSVersion);
            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learnAimRef)).Returns(larsLearningDelivery);
            larsReferenceDataServiceMock.Setup(l => l.LARSStandardForStandardCode(stdCode)).Returns(larsStandard);

            postcodesRefererenceDataServiceMock.Setup(l => l.DASDisadvantagesForPostcode(It.IsAny <string>())).Returns(dasDisadvantage);
            appsHistoryRefererenceDataServiceMock.Setup(l => l.AECEarningsHistory(It.IsAny <long>())).Returns(new List <AECEarningsHistory>());

            var dataEntities = NewService(
                larsReferenceDataServiceMock.Object,
                postcodesRefererenceDataServiceMock.Object,
                appsHistoryRefererenceDataServiceMock.Object)
                               .MapTo(ukprn, learnerDtos);

            dataEntities.Should().HaveCount(2);
            dataEntities.SelectMany(d => d.Children).Should().NotBeNullOrEmpty();
        }
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsRefererenceDataServiceMock    = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();
            var fcsReferenceDataServiceMock       = new Mock <IFCSReferenceDataService>();
            var fileDataServiceMock = new Mock <IFileDataService>();

            var learner = new TestLearner
            {
                LearnRefNumber            = "Learner1",
                ULN                       = 1234567890,
                PostcodePrior             = "Postcode",
                LearnerEmploymentStatuses = new List <TestLearnerEmploymentStatus>
                {
                    new TestLearnerEmploymentStatus
                    {
                        EmpIdNullable  = 10,
                        AgreeId        = "1",
                        DateEmpStatApp = new DateTime(2018, 8, 1),
                        EmpStat        = 2,
                    },
                },
                LearningDeliveries = new List <TestLearningDelivery>
                {
                    new TestLearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        ConRefNumber         = "Conref",
                        DelLocPostCode       = "Postcode",
                        FundModel            = 70,
                        PwayCodeNullable     = 5,
                        ProgTypeNullable     = 6,
                        FworkCodeNullable    = 7,
                        StdCodeNullable      = 8,
                        LearnStartDate       = new DateTime(2018, 8, 1),
                        LearnPlanEndDate     = new DateTime(2019, 8, 1),
                        LearningDeliveryFAMs = new List <TestLearningDeliveryFAM>
                        {
                            new TestLearningDeliveryFAM()
                        },
                        AppFinRecords = new List <TestAppFinRecord>
                        {
                            new TestAppFinRecord(),
                        },
                    },
                },
            };

            var fcsContract = new List <FCSContractAllocation>
            {
                new FCSContractAllocation
                {
                    FCSContractDeliverables = new List <FCSContractDeliverable>
                    {
                        new FCSContractDeliverable()
                    }
                }
            };

            var sfaAreaCosts = new List <SfaAreaCost>
            {
                new SfaAreaCost
                {
                    Postcode       = "Postcode",
                    AreaCostFactor = 1.2m,
                    EffectiveFrom  = new DateTime(2000, 8, 1)
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery();

            var larsFunding = new List <LARSFunding>
            {
                new LARSFunding()
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsRefererenceDataServiceMock.Setup(l => l.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsFunding);
            larsRefererenceDataServiceMock.Setup(l => l.LARSFFrameworkAimsForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSFrameworkAims> {
                new LARSFrameworkAims()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSAnnualValuesForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSAnnualValue> {
                new LARSAnnualValue()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryCategoriesForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSLearningDeliveryCategory> {
                new LARSLearningDeliveryCategory()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(sfaAreaCosts);
            fcsReferenceDataServiceMock.Setup(p => p.FcsContractsForConRef(learningDelivery.ConRefNumber)).Returns(fcsContract);
            fileDataServiceMock.Setup(f => f.DPOutcomesForLearnRefNumber(learner.LearnRefNumber)).Returns(new List <DPOutcome> {
                new DPOutcome()
            });

            return(new DataEntityMapper(
                       fileDataServiceMock.Object,
                       fcsReferenceDataServiceMock.Object,
                       larsRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object)
                   .BuildGlobalDataEntity(learner, new Global()));
        }
        public IDataEntity GetDataEntityMapperEntity()
        {
            var largeEmployersRefererenceDataServiceMock = new Mock <ILargeEmployersReferenceDataService>();
            var larsReferenceDataServiceMock             = new Mock <ILARSReferenceDataService>();
            var organisationRefererenceDataServiceMock   = new Mock <IOrganisationReferenceDataService>();
            var postcodesReferenceDataServiceMock        = new Mock <IPostcodesReferenceDataService>();

            var learner = new FM35LearnerDto
            {
                LearnRefNumber            = "Learner1",
                PostcodePrior             = "Postcode",
                LearnerEmploymentStatuses = new List <LearnerEmploymentStatus>
                {
                    new LearnerEmploymentStatus
                    {
                        EmpId          = 10,
                        DateEmpStatApp = new DateTime(2019, 8, 1),
                        EmpStat        = 2,
                    },
                },
                LearningDeliveries = new List <LearningDelivery>
                {
                    new LearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        PwayCode             = 5,
                        ProgType             = 6,
                        FworkCode            = 7,
                        FundModel            = 35,
                        StdCode              = 8,
                        LearnStartDate       = new DateTime(2019, 8, 1),
                        LearnPlanEndDate     = new DateTime(2020, 8, 1),
                        DelLocPostCode       = "Postcode",
                        LearningDeliveryFAMs = new List <LearningDeliveryFAM>
                        {
                            new LearningDeliveryFAM()
                        },
                    },
                },
            };

            var frameworks = new List <LARSFramework>
            {
                new LARSFramework
                {
                    EffectiveFromNullable = new DateTime(2019, 1, 1),
                    EffectiveTo           = new DateTime(2020, 1, 1),
                    FworkCode             = 7,
                    ProgType         = 6,
                    PwayCode         = 5,
                    LARSFrameworkAim = new LARSFrameworkAim
                    {
                        EffectiveFrom          = new DateTime(2019, 1, 1),
                        EffectiveTo            = new DateTime(2020, 1, 1),
                        FrameworkComponentType = 1,
                    },
                    LARSFrameworkApprenticeshipFundings = new List <LARSFrameworkApprenticeshipFunding>
                    {
                        new LARSFrameworkApprenticeshipFunding()
                    },
                    LARSFrameworkCommonComponents = new List <LARSFrameworkCommonComponent>
                    {
                        new LARSFrameworkCommonComponent()
                    }
                },
                new LARSFramework
                {
                    EffectiveFromNullable = new DateTime(2019, 1, 1),
                    EffectiveTo           = new DateTime(2020, 1, 1),
                    FworkCode             = 9,
                    ProgType         = 9,
                    PwayCode         = 5,
                    LARSFrameworkAim = new LARSFrameworkAim
                    {
                        EffectiveFrom          = new DateTime(2019, 1, 1),
                        EffectiveTo            = new DateTime(2020, 1, 1),
                        FrameworkComponentType = 1,
                    }
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                LARSAnnualValues = new List <LARSAnnualValue>
                {
                    new LARSAnnualValue()
                },
                LARSLearningDeliveryCategories = new List <LARSLearningDeliveryCategory>
                {
                    new LARSLearningDeliveryCategory()
                },
                LARSFundings = new List <LARSFunding>
                {
                    new LARSFunding()
                },
                LARSFrameworks = frameworks
            };

            var learningDelivery = learner.LearningDeliveries.First();

            largeEmployersRefererenceDataServiceMock.Setup(l => l.LargeEmployersforEmpID(It.IsAny <int>())).Returns(new List <LargeEmployers> {
                new LargeEmployers()
            });
            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            organisationRefererenceDataServiceMock.Setup(o => o.OrganisationFundingForUKPRN(It.IsAny <int>()))
            .Returns(new List <OrgFunding> {
                new OrgFunding {
                    OrgFundFactType = Attributes.OrgFundFactorTypeAdultSkills
                }
            });
            organisationRefererenceDataServiceMock.Setup(o => o.SpecialistResourcesForCampusIdentifier(It.IsAny <string>()))
            .Returns(new List <CampusIdentifierSpecResource> {
                new CampusIdentifierSpecResource {
                    SpecialistResources = "Y", EffectiveFrom = new DateTime(2020, 8, 1)
                }
            });
            organisationRefererenceDataServiceMock.Setup(o => o.PostcodeSpecialistResourcesForUkprn(It.IsAny <int>()))
            .Returns(new List <PostcodeSpecialistResource> {
                new PostcodeSpecialistResource {
                    SpecialistResources = "Y", EffectiveFrom = new DateTime(2020, 8, 1)
                }
            });
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(new List <SfaAreaCost> {
                new SfaAreaCost()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.SFADisadvantagesForPostcode(learner.PostcodePrior)).Returns(new List <SfaDisadvantage> {
                new SfaDisadvantage()
            });

            return(new DataEntityMapper(
                       largeEmployersRefererenceDataServiceMock.Object,
                       larsReferenceDataServiceMock.Object,
                       organisationRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
        public void BuildLearningDelivery()
        {
            var learningDelivery = new TestLearningDelivery()
            {
                AimSeqNumber               = 1,
                AimType                    = 2,
                CompStatus                 = 3,
                DelLocPostCode             = "DelLocPostcode",
                FundModel                  = 4,
                LearnActEndDateNullable    = new DateTime(2017, 1, 1),
                LearnAimRef                = "LearnAimRef",
                LearnPlanEndDate           = new DateTime(2018, 1, 1),
                LearnStartDate             = new DateTime(2019, 1, 1),
                OrigLearnStartDateNullable = new DateTime(2019, 1, 1),
                OtherFundAdjNullable       = 5,
                OutcomeNullable            = 6,
                PriorLearnFundAdjNullable  = 7,
                LearningDeliveryFAMs       = new List <TestLearningDeliveryFAM>()
                {
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "ADL", LearnDelFAMCode = "ADL"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM1"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM2"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM3"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM4"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "RES", LearnDelFAMCode = "RES"
                    },
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode         = "awardOrgCode",
                EFACOFType           = 1,
                LearnAimRefTitle     = "learnAimRefTitle",
                LearnAimRefType      = "learnAimRefType",
                RegulatedCreditValue = 2,
                NotionalNVQLevelv2   = "NVQLevel",
                LARSFunding          = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2018, 1, 1),
                        EffectiveTo     = new DateTime(2019, 1, 1),
                    }
                },
                LARSCareerLearningPilot = new List <LARSCareerLearningPilot>
                {
                    new LARSCareerLearningPilot
                    {
                        AreaCode      = "DelLocPostcode",
                        SubsidyRate   = 1.2m,
                        EffectiveFrom = new DateTime(2018, 1, 1),
                        EffectiveTo   = new DateTime(2019, 1, 1)
                    }
                }
            };

            var sfaAreaCost = new List <SfaAreaCost>
            {
                new SfaAreaCost
                {
                    Postcode       = "DelLocPostcode",
                    EffectiveFrom  = new DateTime(2018, 1, 1),
                    EffectiveTo    = new DateTime(2019, 1, 1),
                    AreaCostFactor = 1.2m
                }
            };

            var subsidyPilotPostcodeArea = new List <CareerLearningPilot>
            {
                new CareerLearningPilot
                {
                    Postcode      = "DelLocPostcode",
                    EffectiveFrom = new DateTime(2018, 1, 1),
                    EffectiveTo   = new DateTime(2019, 1, 1),
                    AreaCode      = "AreaCode"
                }
            };

            var larsReferenceDataServiceMock     = new Mock <ILARSReferenceDataService>();
            var postcodeReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            postcodeReferenceDataServiceMock.Setup(o => o.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(sfaAreaCost);
            postcodeReferenceDataServiceMock.Setup(o => o.CareerLearningPilotsForPostcode(learningDelivery.DelLocPostCode)).Returns(subsidyPilotPostcodeArea);

            var dataEntity = NewService(larsReferenceDataServiceMock.Object, postcodeReferenceDataServiceMock.Object).BuildLearningDeliveryDataEntity(learningDelivery);

            dataEntity.EntityName.Should().Be("LearningDelivery");
            dataEntity.Attributes.Should().HaveCount(19);
            dataEntity.Attributes["AimSeqNumber"].Value.Should().Be(learningDelivery.AimSeqNumber);
            dataEntity.Attributes["CompStatus"].Value.Should().Be(learningDelivery.CompStatus);
            dataEntity.Attributes["LearnActEndDate"].Value.Should().Be(learningDelivery.LearnActEndDateNullable);
            dataEntity.Attributes["LearnAimRefType"].Value.Should().Be(larsLearningDelivery.LearnAimRefType);
            dataEntity.Attributes["LearnDelFundModel"].Value.Should().Be(learningDelivery.FundModel);
            dataEntity.Attributes["LearnPlanEndDate"].Value.Should().Be(learningDelivery.LearnPlanEndDate);
            dataEntity.Attributes["LearnStartDate"].Value.Should().Be(learningDelivery.LearnStartDate);
            dataEntity.Attributes["LrnDelFAM_ADL"].Value.Should().Be("ADL");
            dataEntity.Attributes["LrnDelFAM_LDM1"].Value.Should().Be("LDM1");
            dataEntity.Attributes["LrnDelFAM_LDM2"].Value.Should().Be("LDM2");
            dataEntity.Attributes["LrnDelFAM_LDM3"].Value.Should().Be("LDM3");
            dataEntity.Attributes["LrnDelFAM_LDM4"].Value.Should().Be("LDM4");
            dataEntity.Attributes["LrnDelFAM_RES"].Value.Should().Be("RES");
            dataEntity.Attributes["NotionalNVQLevelv2"].Value.Should().Be(larsLearningDelivery.NotionalNVQLevelv2);
            dataEntity.Attributes["OrigLearnStartDate"].Value.Should().Be(learningDelivery.OrigLearnStartDateNullable);
            dataEntity.Attributes["OtherFundAdj"].Value.Should().Be(learningDelivery.OtherFundAdjNullable);
            dataEntity.Attributes["Outcome"].Value.Should().Be(learningDelivery.OutcomeNullable);
            dataEntity.Attributes["PriorLearnFundAdj"].Value.Should().Be(learningDelivery.PriorLearnFundAdjNullable);
            dataEntity.Attributes["RegulatedCreditValue"].Value.Should().Be(larsLearningDelivery.RegulatedCreditValue);
        }
Beispiel #13
0
        public void Build_SingleRow()
        {
            var reportServiceContext = Mock.Of <IReportServiceContext>();
            var dependentDataMock    = new Mock <IReportServiceDependentData>();

            var learningDeliveryFams = new List <ILearningDeliveryFAM>()
            {
                new TestLearningDeliveryFAM()
            };

            var providerSpecDeliveryMonitorings = new List <IProviderSpecDeliveryMonitoring>()
            {
                new TestProviderSpecDeliveryMonitoring(),
            };

            var appFinRecords = new List <IAppFinRecord>()
            {
                new TestAppFinRecord(),
            };

            var learningDelivery = new TestLearningDelivery()
            {
                FundModel                       = 81,
                LearnAimRef                     = "learnAimRef",
                AimSeqNumber                    = 1,
                AimType                         = 1,
                ProgTypeNullable                = 25,
                LearningDeliveryFAMs            = learningDeliveryFams,
                ProviderSpecDeliveryMonitorings = providerSpecDeliveryMonitorings,
                AppFinRecords                   = appFinRecords
            };

            var providerSpecLearnerMonitorings = new List <IProviderSpecLearnerMonitoring>()
            {
                new TestProviderSpecLearnerMonitoring(),
            };

            var learner = new TestLearner()
            {
                LearnRefNumber     = "LearnRefNumber",
                LearningDeliveries = new List <ILearningDelivery>()
                {
                    learningDelivery
                },
                ProviderSpecLearnerMonitorings = providerSpecLearnerMonitorings,
            };

            var message = new TestMessage()
            {
                Learners = new List <ILearner>()
                {
                    learner
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery()
            {
                LearnAimRef = "learnAimRef"
            };

            var referenceDataRoot = new ReferenceDataRoot()
            {
                LARSLearningDeliveries = new List <LARSLearningDelivery>()
                {
                    larsLearningDelivery
                }
            };

            var fm81LearningDeliveryValue = new LearningDeliveryValue();

            var fm81LearningDelivery = new LearningDelivery()
            {
                AimSeqNumber                     = 1,
                LearningDeliveryValues           = fm81LearningDeliveryValue,
                LearningDeliveryPeriodisedValues = new List <LearningDeliveryPeriodisedValue>()
                {
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm81CoreGovContPayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm81MathEngOnProgPayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm81MathEngBalPayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm81LearnSuppFundCash),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm81SmallBusPayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm81YoungAppPayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm81AchPayment),
                }
            };

            var fm81Global = new FM81Global()
            {
                Learners = new List <FM81Learner>()
                {
                    new FM81Learner()
                    {
                        LearnRefNumber     = "LearnRefNumber",
                        LearningDeliveries = new List <LearningDelivery>()
                        {
                            fm81LearningDelivery,
                        }
                    }
                }
            };

            dependentDataMock.Setup(d => d.Get <IMessage>()).Returns(message);
            dependentDataMock.Setup(d => d.Get <ReferenceDataRoot>()).Returns(referenceDataRoot);
            dependentDataMock.Setup(d => d.Get <FM81Global>()).Returns(fm81Global);

            var providerSpecDeliveryMonitoringModel = new ProviderSpecDeliveryMonitoringModel();
            var providerSpecLearnerMonitoringModel  = new ProviderSpecLearnerMonitoringModel();
            var learningDeliveryFamsModel           = new LearningDeliveryFAMsModel();

            var ilrModelMapperMock = new Mock <IIlrModelMapper>();

            ilrModelMapperMock.Setup(m => m.MapLearningDeliveryFAMs(learningDeliveryFams)).Returns(learningDeliveryFamsModel);
            ilrModelMapperMock.Setup(m => m.MapProviderSpecDeliveryMonitorings(providerSpecDeliveryMonitorings)).Returns(providerSpecDeliveryMonitoringModel);
            ilrModelMapperMock.Setup(m => m.MapProviderSpecLearnerMonitorings(providerSpecLearnerMonitorings)).Returns(providerSpecLearnerMonitoringModel);

            var result = NewBuilder(ilrModelMapperMock.Object).Build(reportServiceContext, dependentDataMock.Object).ToList();

            result.Should().HaveCount(1);

            var row = result[0];

            row.Learner.Should().Be(learner);
            row.LearningDelivery.Should().Be(learningDelivery);
            row.LarsLearningDelivery.Should().Be(larsLearningDelivery);
            row.Fm81LearningDelivery.Should().Be(fm81LearningDeliveryValue);

            row.ProviderSpecDeliveryMonitoring.Should().Be(providerSpecDeliveryMonitoringModel);
            row.ProviderSpecLearnerMonitoring.Should().Be(providerSpecLearnerMonitoringModel);
            row.PeriodisedValues.Should().NotBeNull();
            row.LearningDeliveryFAMs.Should().Be(learningDeliveryFamsModel);
        }
Beispiel #14
0
        public void BuildLearningDelivery()
        {
            var learningDelivery = new LearningDelivery()
            {
                AimSeqNumber         = 1,
                AimType              = 2,
                CompStatus           = 3,
                DelLocPostCode       = "DelLocPostcode",
                FundModel            = 4,
                LearnActEndDate      = new DateTime(2017, 1, 1),
                LearnAimRef          = "LearnAimRef",
                LearnPlanEndDate     = new DateTime(2019, 1, 1),
                LearnStartDate       = new DateTime(2020, 1, 1),
                PHours               = 7,
                ProgType             = 8,
                WithdrawReason       = 9,
                LearningDeliveryFAMs = new List <LearningDeliveryFAM>()
                {
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "SOF", LearnDelFAMCode = "SOF"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM1"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM2"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM3"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM4"
                    },
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery()
            {
                AwardOrgCode           = "awardOrgCode",
                EFACOFType             = 1,
                LearnAimRefTitle       = "learnAimRefTitle",
                LearnAimRefType        = "learnAimRefType",
                SectorSubjectAreaTier2 = 1.0m,
                GuidedLearningHours    = 1,
                NotionalNVQLevel       = "NotionalNVQLevel"
            };

            var larsReferenceDataServiceMock = new Mock <ILARSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);

            var dataEntity = NewService(larsReferenceDataServiceMock.Object).BuildLearningDeliveryDataEntity(learningDelivery);

            dataEntity.EntityName.Should().Be("LearningDelivery");
            dataEntity.Attributes.Should().HaveCount(19);
            dataEntity.Attributes["AimSeqNumber"].Value.Should().Be(learningDelivery.AimSeqNumber);
            dataEntity.Attributes["AimType"].Value.Should().Be(learningDelivery.AimType);
            dataEntity.Attributes["AwardOrgCode"].Value.Should().Be(larsLearningDelivery.AwardOrgCode);
            dataEntity.Attributes["DelLocPostCode"].Value.Should().Be(learningDelivery.DelLocPostCode);
            dataEntity.Attributes["CompStatus"].Value.Should().Be(learningDelivery.CompStatus);
            dataEntity.Attributes["EFACOFType"].Value.Should().Be(larsLearningDelivery.EFACOFType);
            dataEntity.Attributes["FundModel"].Value.Should().Be(learningDelivery.FundModel);
            dataEntity.Attributes["GuidedLearningHours"].Value.Should().Be(larsLearningDelivery.GuidedLearningHours);
            dataEntity.Attributes["LearnActEndDate"].Value.Should().Be(learningDelivery.LearnActEndDate);
            dataEntity.Attributes["LearnAimRef"].Value.Should().Be(learningDelivery.LearnAimRef);
            dataEntity.Attributes["LearnAimRefTitle"].Value.Should().Be(larsLearningDelivery.LearnAimRefTitle);
            dataEntity.Attributes["LearnAimRefType"].Value.Should().Be(larsLearningDelivery.LearnAimRefType);
            dataEntity.Attributes["LearnPlanEndDate"].Value.Should().Be(learningDelivery.LearnPlanEndDate);
            dataEntity.Attributes["LearnStartDate"].Value.Should().Be(learningDelivery.LearnStartDate);
            dataEntity.Attributes["NotionalNVQLevel"].Value.Should().Be(larsLearningDelivery.NotionalNVQLevel);
            dataEntity.Attributes["PHours"].Value.Should().Be(learningDelivery.PHours);
            dataEntity.Attributes["ProgType"].Value.Should().Be(learningDelivery.ProgType);
            dataEntity.Attributes["SectorSubjectAreaTier2"].Value.Should().Be(larsLearningDelivery.SectorSubjectAreaTier2);
            dataEntity.Attributes["WithdrawReason"].Value.Should().Be(learningDelivery.WithdrawReason);
        }
        public void Build_SingleRow()
        {
            var reportServiceContext = Mock.Of <IReportServiceContext>();
            var dependentDataMock    = new Mock <IReportServiceDependentData>();

            var learningDeliveryFams = new List <ILearningDeliveryFAM>()
            {
                new TestLearningDeliveryFAM()
                {
                    LearnDelFAMType = "SOF",
                    LearnDelFAMCode = "110",
                }
            };

            var providerSpecDeliveryMonitorings = new List <IProviderSpecDeliveryMonitoring>()
            {
                new TestProviderSpecDeliveryMonitoring(),
            };

            var learningDelivery = new TestLearningDelivery()
            {
                LearnAimRef                     = "learnAimRef",
                AimSeqNumber                    = 1,
                LSDPostcode                     = "Postcode1",
                LearningDeliveryFAMs            = learningDeliveryFams,
                PartnerUKPRNNullable            = 12345678,
                ProviderSpecDeliveryMonitorings = providerSpecDeliveryMonitorings
            };

            var providerSpecLearnerMonitorings = new List <IProviderSpecLearnerMonitoring>()
            {
                new TestProviderSpecLearnerMonitoring(),
            };

            var learner = new TestLearner()
            {
                LearnRefNumber     = "LearnRefNumber",
                LearningDeliveries = new List <ILearningDelivery>()
                {
                    learningDelivery
                },
                ProviderSpecLearnerMonitorings = providerSpecLearnerMonitorings,
            };

            var message = new TestMessage()
            {
                Learners = new List <ILearner>()
                {
                    learner
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery()
            {
                LearnAimRef = "learnAimRef",
                LARSLearningDeliveryCategories = new HashSet <LARSLearningDeliveryCategory>
                {
                    new LARSLearningDeliveryCategory
                    {
                        CategoryRef = 123
                    }
                }
            };

            var mcaGlaSofLookup = new McaGlaSofLookup()
            {
                SofCode         = "110",
                McaGlaShortCode = "GMCA",
                McaGlaFullName  = "GMCA Full",
            };

            var referenceDataRoot = new ReferenceDataRoot()
            {
                LARSLearningDeliveries = new List <LARSLearningDelivery>()
                {
                    larsLearningDelivery
                },
                Postcodes = new List <Postcode>
                {
                    new Postcode
                    {
                        PostCode = "Postcode1"
                    }
                },
                DevolvedPostocdes = new DevolvedPostcodes()
                {
                    McaGlaSofLookups = new List <McaGlaSofLookup>()
                    {
                        mcaGlaSofLookup
                    }
                },
                Organisations = new List <Organisation>()
                {
                    new Organisation()
                    {
                        UKPRN = 12345678, Name = "Partner Provider"
                    }
                }
            };

            var fm35LearningDeliveryValue = new LearningDeliveryValue();

            var fm35LearningDelivery = new LearningDelivery()
            {
                AimSeqNumber                     = 1,
                LearningDeliveryValue            = fm35LearningDeliveryValue,
                LearningDeliveryPeriodisedValues = new List <LearningDeliveryPeriodisedValue>()
                {
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35OnProgPayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35AchievePayPct),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35AchievePayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35EmpOutcomePay),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35BalancePayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35LearnSuppFundCash),
                }
            };

            var fm35Global = new FM35Global()
            {
                Learners = new List <FM35Learner>()
                {
                    new FM35Learner()
                    {
                        LearnRefNumber     = "LearnRefNumber",
                        LearningDeliveries = new List <LearningDelivery>()
                        {
                            fm35LearningDelivery,
                        }
                    }
                }
            };

            dependentDataMock.Setup(d => d.Get <IMessage>()).Returns(message);
            dependentDataMock.Setup(d => d.Get <ReferenceDataRoot>()).Returns(referenceDataRoot);
            dependentDataMock.Setup(d => d.Get <FM35Global>()).Returns(fm35Global);

            var providerSpecDeliveryMonitoringModel = new ProviderSpecDeliveryMonitoringModel();
            var providerSpecLearnerMonitoringModel  = new ProviderSpecLearnerMonitoringModel();
            var learningDeliveryFamsModel           = new LearningDeliveryFAMsModel()
            {
                SOF = "110"
            };

            var ilrModelMapperMock      = new Mock <IIlrModelMapper>();
            var academicYearServiceMock = new Mock <IAcademicYearService>();

            ilrModelMapperMock.Setup(m => m.MapLearningDeliveryFAMs(learningDeliveryFams)).Returns(learningDeliveryFamsModel);
            ilrModelMapperMock.Setup(m => m.MapProviderSpecDeliveryMonitorings(providerSpecDeliveryMonitorings)).Returns(providerSpecDeliveryMonitoringModel);
            ilrModelMapperMock.Setup(m => m.MapProviderSpecLearnerMonitorings(providerSpecLearnerMonitorings)).Returns(providerSpecLearnerMonitoringModel);

            var result = NewBuilder(ilrModelMapperMock.Object, academicYearServiceMock.Object).Build(reportServiceContext, dependentDataMock.Object).ToList();

            result.Should().HaveCount(1);

            var row = result[0];

            row.Learner.Should().Be(learner);
            row.LearningDelivery.Should().Be(learningDelivery);
            row.LarsLearningDelivery.Should().Be(larsLearningDelivery);
            row.Fm35LearningDelivery.Should().Be(fm35LearningDeliveryValue);

            row.ProviderSpecDeliveryMonitoring.Should().Be(providerSpecDeliveryMonitoringModel);
            row.ProviderSpecLearnerMonitoring.Should().Be(providerSpecLearnerMonitoringModel);
            row.PeriodisedValues.Should().NotBeNull();
            row.LearningDeliveryFAMs.Should().Be(learningDeliveryFamsModel);

            row.McaGlaShortCode.Should().Be("GMCA");
        }
Beispiel #16
0
        public void MapTo()
        {
            var ukprn           = 1;
            var larsVersion     = "1.0.0";
            var orgVersion      = "1.0.0";
            var postcodeVersion = "1.0.0";
            var learnAimRef     = "LearnAimRef";
            var postcode        = "Postcode";
            var uplift          = 1.2m;

            var global = new Global
            {
                LARSVersion                         = larsVersion,
                UKPRN                               = ukprn,
                OrgVersion                          = orgVersion,
                PostcodesVersion                    = postcodeVersion,
                AreaCostFactor1618                  = "HISTORIC AREA COST FACTOR VALUE",
                DisadvantageProportion              = "HISTORIC DISADVANTAGE FUNDING PROPORTION VALUE",
                HistoricLargeProgrammeProportion    = "HISTORIC LARGE PROGRAMME PROPORTION VALUE",
                ProgrammeWeighting                  = "HISTORIC PROGRAMME COST WEIGHTING FACTOR VALUE",
                RetentionFactor                     = "HISTORIC RETENTION FACTOR VALUE",
                Level3ProgMathsAndEnglishProportion = "HISTORIC LEVEL 3 PROGRAMME MATHS AND ENGLISH PROPORTION",
                SpecialistResources                 = true
            };

            var learnerDtos = new List <FM25LearnerDto>
            {
                new FM25LearnerDto
                {
                    Postcode           = postcode,
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef = learnAimRef,
                            FundModel   = 25,
                        }
                    }
                },
                new FM25LearnerDto
                {
                    Postcode           = postcode,
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef = learnAimRef,
                            FundModel   = 25,
                        }
                    }
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode         = "awardOrgCode",
                EFACOFType           = 1,
                LearnAimRefTitle     = "learnAimRefTitle",
                LearnAimRefType      = "learnAimRefType",
                RegulatedCreditValue = 2,
                NotionalNVQLevelv2   = "NVQLevel",
                LARSFundings         = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2019, 1, 1),
                        EffectiveTo     = new DateTime(2020, 1, 1),
                    }
                }
            };

            var orgFundings = TestOrgFundingDataset();

            var larsReferenceDataServiceMock      = new Mock <ILARSReferenceDataService>();
            var orgReferenceDataServiceMock       = new Mock <IOrganisationReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSCurrentVersion()).Returns(larsVersion);
            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learnAimRef)).Returns(larsLearningDelivery);
            orgReferenceDataServiceMock.Setup(o => o.OrganisationVersion()).Returns(orgVersion);
            orgReferenceDataServiceMock.Setup(o => o.OrganisationFundingForUKPRN(ukprn)).Returns(orgFundings);
            postcodesReferenceDataServiceMock.Setup(p => p.PostcodesCurrentVersion()).Returns(postcodeVersion);
            postcodesReferenceDataServiceMock.Setup(p => p.LatestEFADisadvantagesUpliftForPostcode(postcode)).Returns(uplift);

            var dataEntities = NewService(
                larsReferenceDataService: larsReferenceDataServiceMock.Object,
                organisationReferenceDataService: orgReferenceDataServiceMock.Object,
                postcodesReferenceDataService: postcodesReferenceDataServiceMock.Object).MapTo(ukprn, learnerDtos);

            dataEntities.Should().HaveCount(2);
            dataEntities.SelectMany(d => d.Children).Should().NotBeNullOrEmpty();
        }
Beispiel #17
0
        public void BuildLearningDelivery()
        {
            var learningDelivery = new TestLearningDelivery()
            {
                AimSeqNumber               = 1,
                AimType                    = 2,
                CompStatus                 = 3,
                ConRefNumber               = "ConRef1",
                DelLocPostCode             = "DelLocPostcode",
                FundModel                  = 4,
                FworkCodeNullable          = 5,
                LearnActEndDateNullable    = new DateTime(2017, 1, 1),
                LearnAimRef                = "LearnAimRef",
                LearnPlanEndDate           = new DateTime(2018, 1, 1),
                LearnStartDate             = new DateTime(2019, 1, 1),
                OrigLearnStartDateNullable = new DateTime(2019, 1, 1),
                OtherFundAdjNullable       = 6,
                OutcomeNullable            = 7,
                PriorLearnFundAdjNullable  = 8,
                StdCodeNullable            = 9,
                LearningDeliveryFAMs       = new List <TestLearningDeliveryFAM>()
                {
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM1"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM2"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM3"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM4"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "EEF", LearnDelFAMCode = "EEF"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "FFI", LearnDelFAMCode = "FFI"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "RES", LearnDelFAMCode = "RES"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "SOF", LearnDelFAMCode = "SOF"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "SPP", LearnDelFAMCode = "SPP"
                    },
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode             = "awardOrgCode",
                EFACOFType               = 1,
                FrameworkCommonComponent = 2,
                LearnAimRefTitle         = "learnAimRefTitle",
                LearnAimRefType          = "learnAimRefType",
                RegulatedCreditValue     = 3,
                NotionalNVQLevelv2       = "NVQLevel",
                LearningDeliveryGenre    = "Genre",
                LARSFunding              = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2018, 1, 1),
                        EffectiveTo     = new DateTime(2019, 1, 1),
                    },
                },
            };

            var larsReferenceDataServiceMock = new Mock <ILARSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsReferenceDataServiceMock.Setup(l => l.LARSStandardCommonComponent(learningDelivery.StdCodeNullable)).Returns(new List <LARSStandardCommonComponent> {
                new LARSStandardCommonComponent()
            });
            larsReferenceDataServiceMock.Setup(l => l.LARSStandardFunding(learningDelivery.StdCodeNullable)).Returns(new List <LARSStandardFunding> {
                new LARSStandardFunding()
            });

            var dataEntity = NewService(larsReferenceDataService: larsReferenceDataServiceMock.Object)
                             .BuildLearningDeliveryDataEntity(learningDelivery);

            dataEntity.EntityName.Should().Be("LearningDelivery");
            dataEntity.Attributes.Should().HaveCount(25);
            dataEntity.Attributes["AchDate"].Value.Should().Be(learningDelivery.AchDateNullable);
            dataEntity.Attributes["AimSeqNumber"].Value.Should().Be(learningDelivery.AimSeqNumber);
            dataEntity.Attributes["AimType"].Value.Should().Be(learningDelivery.AimType);
            dataEntity.Attributes["CompStatus"].Value.Should().Be(learningDelivery.CompStatus);
            dataEntity.Attributes["FrameworkCommonComponent"].Value.Should().Be(larsLearningDelivery.FrameworkCommonComponent);
            dataEntity.Attributes["LearnAimRef"].Value.Should().Be(learningDelivery.LearnAimRef);
            dataEntity.Attributes["LearnActEndDate"].Value.Should().Be(learningDelivery.LearnActEndDateNullable);
            dataEntity.Attributes["LearnPlanEndDate"].Value.Should().Be(learningDelivery.LearnPlanEndDate);
            dataEntity.Attributes["LearnStartDate"].Value.Should().Be(learningDelivery.LearnStartDate);
            dataEntity.Attributes["LrnDelFAM_EEF"].Value.Should().Be("EEF");
            dataEntity.Attributes["LrnDelFAM_FFI"].Value.Should().Be("FFI");
            dataEntity.Attributes["LrnDelFAM_LDM1"].Value.Should().Be("LDM1");
            dataEntity.Attributes["LrnDelFAM_LDM2"].Value.Should().Be("LDM2");
            dataEntity.Attributes["LrnDelFAM_LDM3"].Value.Should().Be("LDM3");
            dataEntity.Attributes["LrnDelFAM_LDM4"].Value.Should().Be("LDM4");
            dataEntity.Attributes["LrnDelFAM_RES"].Value.Should().Be("RES");
            dataEntity.Attributes["LrnDelFAM_SOF"].Value.Should().Be("SOF");
            dataEntity.Attributes["LrnDelFAM_SPP"].Value.Should().Be("SPP");
            dataEntity.Attributes["OrigLearnStartDate"].Value.Should().Be(learningDelivery.OrigLearnStartDateNullable);
            dataEntity.Attributes["OtherFundAdj"].Value.Should().Be(learningDelivery.OtherFundAdjNullable);
            dataEntity.Attributes["Outcome"].Value.Should().Be(learningDelivery.OutcomeNullable);
            dataEntity.Attributes["PriorLearnFundAdj"].Value.Should().Be(learningDelivery.PriorLearnFundAdjNullable);
            dataEntity.Attributes["ProgType"].Value.Should().Be(learningDelivery.ProgTypeNullable);
            dataEntity.Attributes["STDCode"].Value.Should().Be(learningDelivery.StdCodeNullable);
            dataEntity.Attributes["WithdrawReason"].Value.Should().Be(learningDelivery.WithdrawReasonNullable);
        }
Beispiel #18
0
        public void BuildLearningDelivery()
        {
            var learningDelivery = new TestLearningDelivery()
            {
                AimSeqNumber               = 1,
                AimType                    = 2,
                CompStatus                 = 3,
                DelLocPostCode             = "DelLocPostcode",
                FundModel                  = 4,
                FworkCodeNullable          = 5,
                LearnActEndDateNullable    = new DateTime(2017, 1, 1),
                LearnAimRef                = "LearnAimRef",
                LearnPlanEndDate           = new DateTime(2018, 1, 1),
                LearnStartDate             = new DateTime(2019, 1, 1),
                OrigLearnStartDateNullable = new DateTime(2019, 1, 1),
                OtherFundAdjNullable       = 6,
                OutcomeNullable            = 7,
                PriorLearnFundAdjNullable  = 8,
                ProgTypeNullable           = 9,
                PwayCodeNullable           = 10,
                StdCodeNullable            = 11,
                LearningDeliveryFAMs       = new List <TestLearningDeliveryFAM>()
                {
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "EEF", LearnDelFAMCode = "EEF"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM1"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM2"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM3"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM4"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "FFI", LearnDelFAMCode = "FFI"
                    },
                    new TestLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "RES", LearnDelFAMCode = "RES"
                    },
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode             = "awardOrgCode",
                EFACOFType               = 1,
                FrameworkCommonComponent = 2,
                LearnAimRefTitle         = "learnAimRefTitle",
                LearnAimRefType          = "learnAimRefType",
                RegulatedCreditValue     = 3,
                NotionalNVQLevelv2       = "NVQLevel",
                LARSFunding              = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2018, 1, 1),
                        EffectiveTo     = new DateTime(2019, 1, 1),
                    },
                },
                LARSCareerLearningPilot = new List <LARSCareerLearningPilot>
                {
                    new LARSCareerLearningPilot
                    {
                        AreaCode      = "DelLocPostcode",
                        SubsidyRate   = 1.2m,
                        EffectiveFrom = new DateTime(2018, 1, 1),
                        EffectiveTo   = new DateTime(2019, 1, 1),
                    },
                },
            };

            var frameworkAims = new List <LARSFrameworkAims>
            {
                new LARSFrameworkAims
                {
                    LearnAimRef            = "LearnAimRef",
                    EffectiveFrom          = new DateTime(2018, 1, 1),
                    EffectiveTo            = new DateTime(2019, 1, 1),
                    FrameworkComponentType = 1,
                    FworkCode = 5,
                    ProgType  = 9,
                    PwayCode  = 10,
                },
            };

            var larsReferenceDataServiceMock      = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsReferenceDataServiceMock.Setup(l => l.LARSFFrameworkAimsForLearnAimRef(learningDelivery.LearnAimRef)).Returns(frameworkAims);
            larsReferenceDataServiceMock.Setup(l => l.LARSAnnualValuesForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSAnnualValue> {
                new LARSAnnualValue()
            });
            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryCategoriesForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSLearningDeliveryCategory> {
                new LARSLearningDeliveryCategory()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(new List <SfaAreaCost> {
                new SfaAreaCost()
            });

            var dataEntity = NewService(larsReferenceDataService: larsReferenceDataServiceMock.Object, postcodesReferenceDataService: postcodesReferenceDataServiceMock.Object).BuildLearningDeliveryDataEntity(learningDelivery);

            dataEntity.EntityName.Should().Be("LearningDelivery");
            dataEntity.Attributes.Should().HaveCount(27);
            dataEntity.Attributes["AchDate"].Value.Should().Be(learningDelivery.AchDateNullable);
            dataEntity.Attributes["AddHours"].Value.Should().Be(learningDelivery.AddHoursNullable);
            dataEntity.Attributes["AimSeqNumber"].Value.Should().Be(learningDelivery.AimSeqNumber);
            dataEntity.Attributes["AimType"].Value.Should().Be(learningDelivery.AimType);
            dataEntity.Attributes["CompStatus"].Value.Should().Be(learningDelivery.CompStatus);
            dataEntity.Attributes["EmpOutcome"].Value.Should().Be(learningDelivery.EmpOutcomeNullable);
            dataEntity.Attributes["EnglandFEHEStatus"].Value.Should().Be(larsLearningDelivery.EnglandFEHEStatus);
            dataEntity.Attributes["EnglPrscID"].Value.Should().Be(larsLearningDelivery.EnglPrscID);
            dataEntity.Attributes["FrameworkCommonComponent"].Value.Should().Be(2);
            dataEntity.Attributes["FworkCode"].Value.Should().Be(learningDelivery.FworkCodeNullable);
            dataEntity.Attributes["LearnActEndDate"].Value.Should().Be(learningDelivery.LearnActEndDateNullable);
            dataEntity.Attributes["LearnPlanEndDate"].Value.Should().Be(learningDelivery.LearnPlanEndDate);
            dataEntity.Attributes["LearnStartDate"].Value.Should().Be(learningDelivery.LearnStartDate);
            dataEntity.Attributes["LrnDelFAM_EEF"].Value.Should().Be("EEF");
            dataEntity.Attributes["LrnDelFAM_LDM1"].Value.Should().Be("LDM1");
            dataEntity.Attributes["LrnDelFAM_LDM2"].Value.Should().Be("LDM2");
            dataEntity.Attributes["LrnDelFAM_LDM3"].Value.Should().Be("LDM3");
            dataEntity.Attributes["LrnDelFAM_LDM4"].Value.Should().Be("LDM4");
            dataEntity.Attributes["LrnDelFAM_FFI"].Value.Should().Be("FFI");
            dataEntity.Attributes["LrnDelFAM_RES"].Value.Should().Be("RES");
            dataEntity.Attributes["OrigLearnStartDate"].Value.Should().Be(learningDelivery.OrigLearnStartDateNullable);
            dataEntity.Attributes["OtherFundAdj"].Value.Should().Be(learningDelivery.OtherFundAdjNullable);
            dataEntity.Attributes["PriorLearnFundAdj"].Value.Should().Be(learningDelivery.PriorLearnFundAdjNullable);
            dataEntity.Attributes["ProgType"].Value.Should().Be(learningDelivery.ProgTypeNullable);
            dataEntity.Attributes["PwayCode"].Value.Should().Be(learningDelivery.PwayCodeNullable);
        }
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsRefererenceDataServiceMock    = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();
            var fcsReferenceDataServiceMock       = new Mock <IFCSReferenceDataService>();

            var learner = new FM70LearnerDto
            {
                LearnRefNumber            = "Learner1",
                LearnerEmploymentStatuses = new List <LearnerEmploymentStatus>
                {
                    new LearnerEmploymentStatus
                    {
                        EmpId          = 10,
                        DateEmpStatApp = new DateTime(2019, 8, 1),
                        EmpStat        = 2,
                    },
                },
                LearningDeliveries = new List <LearningDelivery>
                {
                    new LearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        ConRefNumber         = "Conref",
                        PwayCode             = 5,
                        ProgType             = 6,
                        FworkCode            = 7,
                        FundModel            = 70,
                        StdCode              = 8,
                        LearnStartDate       = new DateTime(2019, 8, 1),
                        LearnPlanEndDate     = new DateTime(2020, 8, 1),
                        DelLocPostCode       = "Postcode",
                        LearningDeliveryFAMs = new List <LearningDeliveryFAM>
                        {
                            new LearningDeliveryFAM
                            {
                                LearnDelFAMCode     = "1",
                                LearnDelFAMType     = "RES",
                                LearnDelFAMDateFrom = new DateTime(2019, 8, 1)
                            }
                        },
                    },
                },
                DPOutcomes = new List <DPOutcome>
                {
                    new DPOutcome
                    {
                        OutCode = 1,
                        OutType = "2",
                    }
                }
            };

            var fcsContract = new List <FCSContractAllocation>
            {
                new FCSContractAllocation
                {
                    FCSContractDeliverables = new List <FCSContractDeliverable>
                    {
                        new FCSContractDeliverable()
                    }
                }
            };

            var sfaAreaCosts = new List <SfaAreaCost>
            {
                new SfaAreaCost
                {
                    Postcode       = "Postcode",
                    AreaCostFactor = 1.2m,
                    EffectiveFrom  = new DateTime(2000, 8, 1)
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                LARSAnnualValues = new List <LARSAnnualValue>
                {
                    new LARSAnnualValue()
                },
                LARSFundings = new List <LARSFunding>
                {
                    new LARSFunding()
                }
            };

            var larsFunding = new List <LARSFunding>
            {
                new LARSFunding()
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(sfaAreaCosts);
            fcsReferenceDataServiceMock.Setup(p => p.FcsContractsForConRef(learningDelivery.ConRefNumber)).Returns(fcsContract);

            return(new DataEntityMapper(
                       fcsReferenceDataServiceMock.Object,
                       larsRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object)
                   .BuildGlobalDataEntity(learner, new Global()));
        }
        public void Build_SingleRow()
        {
            var reportServiceContext = Mock.Of <IReportServiceContext>();
            var dependentDataMock    = new Mock <IReportServiceDependentData>();

            var adlLearningDeliveryFam = new Mock <ILearningDeliveryFAM>();

            adlLearningDeliveryFam.SetupGet(fam => fam.LearnDelFAMType).Returns("ADL");
            adlLearningDeliveryFam.SetupGet(fam => fam.LearnDelFAMCode).Returns("1");

            var albLearningDeliveryFam = new Mock <ILearningDeliveryFAM>();

            albLearningDeliveryFam.SetupGet(fam => fam.LearnDelFAMType).Returns("ALB");


            var learningDeliveryFams = new List <ILearningDeliveryFAM>()
            {
                albLearningDeliveryFam.Object,
                adlLearningDeliveryFam.Object,
            };

            var providerSpecDeliveryMonitorings = new List <IProviderSpecDeliveryMonitoring>()
            {
                new TestProviderSpecDeliveryMonitoring(),
            };

            var learningDelivery = new TestLearningDelivery()
            {
                FundModel                       = 99,
                LearnAimRef                     = "learnAimRef",
                AimSeqNumber                    = 1,
                LearningDeliveryFAMs            = learningDeliveryFams,
                ProviderSpecDeliveryMonitorings = providerSpecDeliveryMonitorings
            };

            var providerSpecLearnerMonitorings = new List <IProviderSpecLearnerMonitoring>()
            {
                new TestProviderSpecLearnerMonitoring(),
            };

            var learner = new TestLearner()
            {
                LearnRefNumber     = "LearnRefNumber",
                LearningDeliveries = new List <ILearningDelivery>()
                {
                    learningDelivery
                },
                ProviderSpecLearnerMonitorings = providerSpecLearnerMonitorings,
            };

            var message = new TestMessage()
            {
                Learners = new List <ILearner>()
                {
                    learner
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery()
            {
                LearnAimRef = "learnAimRef"
            };

            var referenceDataRoot = new ReferenceDataRoot()
            {
                LARSLearningDeliveries = new List <LARSLearningDelivery>()
                {
                    larsLearningDelivery
                }
            };

            var albLearningDeliveryValue = new LearningDeliveryValue();

            var albLearningDelivery = new LearningDelivery()
            {
                AimSeqNumber                     = 1,
                LearningDeliveryValue            = albLearningDeliveryValue,
                LearningDeliveryPeriodisedValues = new List <LearningDeliveryPeriodisedValue>()
                {
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35OnProgPayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35AchievePayPct),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35AchievePayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35EmpOutcomePay),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35BalancePayment),
                    BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35LearnSuppFundCash),
                }
            };

            var fm35Global = new ALBGlobal()
            {
                Learners = new List <ALBLearner>()
                {
                    new ALBLearner()
                    {
                        LearnRefNumber     = "LearnRefNumber",
                        LearningDeliveries = new List <LearningDelivery>()
                        {
                            albLearningDelivery,
                        }
                    }
                }
            };

            dependentDataMock.Setup(d => d.Get <IMessage>()).Returns(message);
            dependentDataMock.Setup(d => d.Get <ReferenceDataRoot>()).Returns(referenceDataRoot);
            dependentDataMock.Setup(d => d.Get <ALBGlobal>()).Returns(fm35Global);

            var providerSpecDeliveryMonitoringModel = new ProviderSpecDeliveryMonitoringModel();
            var providerSpecLearnerMonitoringModel  = new ProviderSpecLearnerMonitoringModel();
            var learningDeliveryFamsModel           = new LearningDeliveryFAMsModel();

            var ilrModelMapperMock = new Mock <IIlrModelMapper>();

            ilrModelMapperMock.Setup(m => m.MapLearningDeliveryFAMs(learningDeliveryFams)).Returns(learningDeliveryFamsModel);
            ilrModelMapperMock.Setup(m => m.MapProviderSpecDeliveryMonitorings(providerSpecDeliveryMonitorings)).Returns(providerSpecDeliveryMonitoringModel);
            ilrModelMapperMock.Setup(m => m.MapProviderSpecLearnerMonitorings(providerSpecLearnerMonitorings)).Returns(providerSpecLearnerMonitoringModel);

            var result = NewBuilder(ilrModelMapperMock.Object).Build(reportServiceContext, dependentDataMock.Object).ToList();

            result.Should().HaveCount(1);

            var row = result[0];

            row.Learner.Should().Be(learner);
            row.LearningDelivery.Should().Be(learningDelivery);
            row.LarsLearningDelivery.Should().Be(larsLearningDelivery);
            row.Fm99LearningDelivery.Should().Be(albLearningDeliveryValue);

            row.ProviderSpecDeliveryMonitoring.Should().Be(providerSpecDeliveryMonitoringModel);
            row.ProviderSpecLearnerMonitoring.Should().Be(providerSpecLearnerMonitoringModel);
            row.PeriodisedValues.Should().NotBeNull();
            row.LearningDeliveryFAMs.Should().Be(learningDeliveryFamsModel);
        }
Beispiel #21
0
        public IDataEntity GetDataEntityMapperEntity()
        {
            var largeEmployersRefererenceDataServiceMock = new Mock <ILargeEmployersReferenceDataService>();
            var larsRefererenceDataServiceMock           = new Mock <ILARSReferenceDataService>();
            var organisationRefererenceDataServiceMock   = new Mock <IOrganisationReferenceDataService>();
            var postcodesReferenceDataServiceMock        = new Mock <IPostcodesReferenceDataService>();
            var fileDataServiceMock = new Mock <IFileDataService>();

            var learner = new TestLearner
            {
                LearnRefNumber            = "Learner1",
                ULN                       = 1234567890,
                PostcodePrior             = "Postcode",
                LearnerEmploymentStatuses = new List <TestLearnerEmploymentStatus>
                {
                    new TestLearnerEmploymentStatus
                    {
                        EmpIdNullable  = 10,
                        AgreeId        = "1",
                        DateEmpStatApp = new DateTime(2018, 8, 1),
                        EmpStat        = 2,
                    },
                },
                LearningDeliveries = new List <TestLearningDelivery>
                {
                    new TestLearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        DelLocPostCode       = "Postcode",
                        PwayCodeNullable     = 5,
                        ProgTypeNullable     = 6,
                        FworkCodeNullable    = 7,
                        FundModel            = 35,
                        StdCodeNullable      = 8,
                        LearnStartDate       = new DateTime(2018, 8, 1),
                        LearnPlanEndDate     = new DateTime(2019, 8, 1),
                        LearningDeliveryFAMs = new List <TestLearningDeliveryFAM>
                        {
                            new TestLearningDeliveryFAM()
                        },
                        AppFinRecords = new List <TestAppFinRecord>
                        {
                            new TestAppFinRecord(),
                        },
                    },
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery();

            var larsFunding = new List <LARSFunding>
            {
                new LARSFunding()
            };

            var learningDelivery = learner.LearningDeliveries.First();

            largeEmployersRefererenceDataServiceMock.Setup(l => l.LargeEmployersforEmpID(It.IsAny <int>())).Returns(new List <LargeEmployers> {
                new LargeEmployers()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsRefererenceDataServiceMock.Setup(l => l.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsFunding);
            larsRefererenceDataServiceMock.Setup(l => l.LARSFFrameworkAimsForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSFrameworkAims> {
                new LARSFrameworkAims()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSAnnualValuesForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSAnnualValue> {
                new LARSAnnualValue()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryCategoriesForLearnAimRef(learningDelivery.LearnAimRef)).Returns(new List <LARSLearningDeliveryCategory> {
                new LARSLearningDeliveryCategory()
            });
            organisationRefererenceDataServiceMock.Setup(o => o.OrganisationFundingForUKPRN(It.IsAny <int>())).Returns(new List <OrgFunding> {
                new OrgFunding {
                    OrgFundFactType = Attributes.OrgFundFactorTypeAdultSkills
                }
            });
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(new List <SfaAreaCost> {
                new SfaAreaCost()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.SFADisadvantagesForPostcode(learner.PostcodePrior)).Returns(new List <SfaDisadvantage> {
                new SfaDisadvantage()
            });

            return(new DataEntityMapper(
                       largeEmployersRefererenceDataServiceMock.Object,
                       larsRefererenceDataServiceMock.Object,
                       organisationRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object,
                       fileDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
Beispiel #22
0
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsReferenceDataServiceMock                = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock           = new Mock <IPostcodesReferenceDataService>();
            var appsEarningsHistoryReferenceDataServiceMock = new Mock <IAppsEarningsHistoryReferenceDataService>();

            var learner = new FM36LearnerDto
            {
                LearnRefNumber            = "Learner1",
                PostcodePrior             = "Postcode",
                ULN                       = 1234567890,
                LearnerEmploymentStatuses = new List <LearnerEmploymentStatus>
                {
                    new LearnerEmploymentStatus
                    {
                        EmpId          = 10,
                        DateEmpStatApp = new DateTime(2018, 8, 1),
                        EmpStat        = 2,
                        SEM            = 1
                    },
                },
                LearningDeliveries = new List <LearningDelivery>
                {
                    new LearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        PwayCode             = 5,
                        ProgType             = 6,
                        FworkCode            = 7,
                        FundModel            = 36,
                        StdCode              = 8,
                        LearnStartDate       = new DateTime(2018, 8, 1),
                        LearnPlanEndDate     = new DateTime(2019, 8, 1),
                        DelLocPostCode       = "Postcode",
                        LearningDeliveryFAMs = new List <LearningDeliveryFAM>
                        {
                            new LearningDeliveryFAM()
                        },
                        AppFinRecords = new List <AppFinRecord>
                        {
                            new AppFinRecord()
                        }
                    },
                },
            };

            var frameworks = new List <LARSFramework>
            {
                new LARSFramework
                {
                    EffectiveFromNullable = new DateTime(2018, 1, 1),
                    EffectiveTo           = new DateTime(2019, 1, 1),
                    FworkCode             = 7,
                    ProgType         = 6,
                    PwayCode         = 5,
                    LARSFrameworkAim = new LARSFrameworkAim
                    {
                        EffectiveFrom          = new DateTime(2018, 1, 1),
                        EffectiveTo            = new DateTime(2019, 1, 1),
                        FrameworkComponentType = 1,
                    },
                    LARSFrameworkApprenticeshipFundings = new List <LARSFrameworkApprenticeshipFunding>
                    {
                        new LARSFrameworkApprenticeshipFunding()
                    },
                    LARSFrameworkCommonComponents = new List <LARSFrameworkCommonComponent>
                    {
                        new LARSFrameworkCommonComponent()
                    }
                },
                new LARSFramework
                {
                    EffectiveFromNullable = new DateTime(2018, 1, 1),
                    EffectiveTo           = new DateTime(2019, 1, 1),
                    FworkCode             = 9,
                    ProgType         = 9,
                    PwayCode         = 5,
                    LARSFrameworkAim = new LARSFrameworkAim
                    {
                        EffectiveFrom          = new DateTime(2018, 1, 1),
                        EffectiveTo            = new DateTime(2019, 1, 1),
                        FrameworkComponentType = 1,
                    }
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                LARSFundings = new List <LARSFunding>
                {
                    new LARSFunding()
                },
                LARSFrameworks = frameworks
            };

            var larsStandards = new LARSStandard
            {
                LARSStandardApprenticeshipFundings = new List <LARSStandardApprenticeshipFunding>
                {
                    new LARSStandardApprenticeshipFunding()
                },
                LARSStandardCommonComponents = new List <LARSStandardCommonComponent>
                {
                    new LARSStandardCommonComponent()
                }
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsReferenceDataServiceMock.Setup(l => l.LARSStandardForStandardCode(learningDelivery.StdCode)).Returns(larsStandards);
            postcodesReferenceDataServiceMock.Setup(p => p.DASDisadvantagesForPostcode(learner.PostcodePrior)).Returns(new List <DasDisadvantage> {
                new DasDisadvantage()
            });
            appsEarningsHistoryReferenceDataServiceMock.Setup(a => a.AECEarningsHistory(learner.ULN)).Returns(new List <AECEarningsHistory> {
                new AECEarningsHistory()
            });

            return(new DataEntityMapper(
                       larsReferenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object,
                       appsEarningsHistoryReferenceDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
        public void MapTo()
        {
            var ukprn          = 1;
            var learnAimRef    = "LearnAimRef";
            var delLocPostCode = "Postcode";
            var conRefNumber   = "ConRefNumber";

            var global = new Global
            {
                UKPRN = 1
            };

            var learnerDtos = new List <FM70LearnerDto>
            {
                new FM70LearnerDto
                {
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef    = learnAimRef,
                            DelLocPostCode = delLocPostCode,
                            FundModel      = 70,
                            ConRefNumber   = conRefNumber
                        }
                    }
                },
                new FM70LearnerDto
                {
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef    = learnAimRef,
                            DelLocPostCode = delLocPostCode,
                            FundModel      = 70,
                            ConRefNumber   = conRefNumber
                        }
                    }
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode         = "awardOrgCode",
                EFACOFType           = 1,
                LearnAimRefTitle     = "learnAimRefTitle",
                LearnAimRefType      = "learnAimRefType",
                RegulatedCreditValue = 2,
                NotionalNVQLevelv2   = "NVQLevel",
                LARSFundings         = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2019, 1, 1),
                        EffectiveTo     = new DateTime(2020, 1, 1),
                    }
                }
            };

            var sfaAreaCost = new List <SfaAreaCost>
            {
                new SfaAreaCost
                {
                    Postcode       = "DelLocPostcode",
                    EffectiveFrom  = new DateTime(2019, 1, 1),
                    EffectiveTo    = new DateTime(2020, 1, 1),
                    AreaCostFactor = 1.2m
                }
            };

            var fcsContract = new List <FCSContractAllocation>
            {
                new FCSContractAllocation
                {
                    CalcMethod = 1,
                    FCSContractDeliverables = new List <FCSContractDeliverable>
                    {
                        new FCSContractDeliverable()
                    }
                }
            };

            var larsReferenceDataServiceMock      = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();
            var fcsReferenceDataMock = new Mock <IFCSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learnAimRef)).Returns(larsLearningDelivery);
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(delLocPostCode)).Returns(new List <SfaAreaCost> {
                new SfaAreaCost()
            });
            fcsReferenceDataMock.Setup(f => f.FcsContractsForConRef(conRefNumber)).Returns(fcsContract);

            var dataEntities = NewService(
                fcsReferenceDataService: fcsReferenceDataMock.Object,
                larsReferenceDataService: larsReferenceDataServiceMock.Object,
                postcodesReferenceDataService: postcodesReferenceDataServiceMock.Object)
                               .MapTo(ukprn, learnerDtos);

            dataEntities.Should().HaveCount(2);
            dataEntities.SelectMany(d => d.Children).Should().NotBeNullOrEmpty();
        }
Beispiel #24
0
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsRefererenceDataServiceMock              = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock           = new Mock <IPostcodesReferenceDataService>();
            var appsEarningsHistoryReferenceDataServiceMock = new Mock <IAppsEarningsHistoryReferenceDataService>();
            var fileDataServiceMock = new Mock <IFileDataService>();

            var learner = new TestLearner
            {
                LearnRefNumber            = "Learner1",
                ULN                       = 1234567890,
                PostcodePrior             = "Postcode",
                LearnerEmploymentStatuses = new List <TestLearnerEmploymentStatus>
                {
                    new TestLearnerEmploymentStatus
                    {
                        AgreeId        = "1",
                        DateEmpStatApp = new DateTime(2018, 8, 1),
                        EmpStat        = 2
                    }
                },
                LearningDeliveries = new List <TestLearningDelivery>
                {
                    new TestLearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        FundModel            = 36,
                        PwayCodeNullable     = 5,
                        ProgTypeNullable     = 6,
                        FworkCodeNullable    = 7,
                        StdCodeNullable      = 8,
                        LearnStartDate       = new DateTime(2018, 8, 1),
                        LearnPlanEndDate     = new DateTime(2019, 8, 1),
                        LearningDeliveryFAMs = new List <TestLearningDeliveryFAM>
                        {
                            new TestLearningDeliveryFAM()
                        },
                        AppFinRecords = new List <TestAppFinRecord>
                        {
                            new TestAppFinRecord()
                        }
                    }
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery();

            var larsFunding = new List <LARSFunding>
            {
                new LARSFunding()
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsRefererenceDataServiceMock.Setup(l => l.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsFunding);
            larsRefererenceDataServiceMock.Setup(l => l.LARSStandardApprenticeshipFunding(learningDelivery.StdCodeNullable, learningDelivery.ProgTypeNullable)).Returns(new List <LARSStandardApprenticeshipFunding> {
                new LARSStandardApprenticeshipFunding()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSFrameworkApprenticeshipFunding(learningDelivery.FworkCodeNullable, learningDelivery.ProgTypeNullable, learningDelivery.PwayCodeNullable)).Returns(new List <LARSFrameworkApprenticeshipFunding> {
                new LARSFrameworkApprenticeshipFunding()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSFrameworkCommonComponent(learningDelivery.LearnAimRef, learningDelivery.FworkCodeNullable, learningDelivery.ProgTypeNullable, learningDelivery.PwayCodeNullable)).Returns(new List <LARSFrameworkCommonComponent> {
                new LARSFrameworkCommonComponent()
            });
            larsRefererenceDataServiceMock.Setup(l => l.LARSStandardCommonComponent(learningDelivery.StdCodeNullable)).Returns(new List <LARSStandardCommonComponent> {
                new LARSStandardCommonComponent()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.DASDisadvantagesForPostcode(learner.PostcodePrior)).Returns(new List <DasDisadvantage> {
                new DasDisadvantage()
            });
            appsEarningsHistoryReferenceDataServiceMock.Setup(a => a.AECEarningsHistory(learner.ULN)).Returns(new List <AECEarningsHistory> {
                new AECEarningsHistory()
            });

            return(new DataEntityMapper(
                       larsRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object,
                       appsEarningsHistoryReferenceDataServiceMock.Object,
                       fileDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
        public void MapTo()
        {
            var ukprn       = 1;
            var learnAimRef = "LearnAImRef";
            var stdCode     = 1;

            var global = new Global
            {
                LARSVersion = "1.0.0",
                UKPRN       = 1234
            };

            var learnerDtos = new List <FM81LearnerDto>
            {
                new FM81LearnerDto
                {
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef = learnAimRef,
                            FundModel   = 81,
                            ProgType    = 25,
                            StdCode     = stdCode
                        }
                    }
                },
                new FM81LearnerDto
                {
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef = learnAimRef,
                            FundModel   = 81,
                            ProgType    = 25,
                            StdCode     = stdCode
                        }
                    }
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode         = "awardOrgCode",
                EFACOFType           = 1,
                LearnAimRefTitle     = "learnAimRefTitle",
                LearnAimRefType      = "learnAimRefType",
                RegulatedCreditValue = 2,
                NotionalNVQLevelv2   = "NVQLevel",
                LARSFundings         = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2020, 1, 1),
                        EffectiveTo     = new DateTime(2020, 1, 1),
                    }
                },
            };

            var larsStandard = new LARSStandard
            {
                StandardCode = 1,
            };

            var larsReferenceDataServiceMock = new Mock <ILARSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSCurrentVersion()).Returns(global.LARSVersion);

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learnAimRef)).Returns(larsLearningDelivery);
            larsReferenceDataServiceMock.Setup(l => l.LARSStandardForStandardCode(stdCode)).Returns(larsStandard);

            var dataEntities = NewService(larsReferenceDataServiceMock.Object).MapTo(ukprn, learnerDtos);

            dataEntities.Should().HaveCount(2);
            dataEntities.SelectMany(d => d.Children).Should().NotBeNullOrEmpty();
        }
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsRefererenceDataServiceMock         = new Mock <ILARSReferenceDataService>();
            var organisationRefererenceDataServiceMock = new Mock <IOrganisationReferenceDataService>();
            var postcodesReferenceDataServiceMock      = new Mock <IPostcodesReferenceDataService>();
            var fileDataServiceMock = new Mock <IFileDataService>();

            var learner = new TestLearner
            {
                LearnRefNumber            = "Learner1",
                ULN                       = 1234567890,
                PostcodePrior             = "Postcode",
                LearnerEmploymentStatuses = new List <TestLearnerEmploymentStatus>
                {
                    new TestLearnerEmploymentStatus
                    {
                        EmpIdNullable  = 10,
                        AgreeId        = "1",
                        DateEmpStatApp = new DateTime(2018, 8, 1),
                        EmpStat        = 2,
                    },
                },
                LearningDeliveries = new List <TestLearningDelivery>
                {
                    new TestLearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        DelLocPostCode       = "Postcode",
                        PwayCodeNullable     = 5,
                        ProgTypeNullable     = 6,
                        FworkCodeNullable    = 7,
                        FundModel            = 25,
                        StdCodeNullable      = 8,
                        LearnStartDate       = new DateTime(2018, 8, 1),
                        LearnPlanEndDate     = new DateTime(2019, 8, 1),
                        LearningDeliveryFAMs = new List <TestLearningDeliveryFAM>
                        {
                            new TestLearningDeliveryFAM()
                        },
                        AppFinRecords = new List <TestAppFinRecord>
                        {
                            new TestAppFinRecord(),
                        },
                    },
                },
            };

            var dpOutcome = new List <DPOutcome>
            {
                new DPOutcome
                {
                    OutCode = 1,
                    OutType = "2",
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                LARSValidities = new List <LARSValidity>
                {
                    new LARSValidity(),
                },
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            organisationRefererenceDataServiceMock.Setup(o => o.OrganisationFundingForUKPRN(It.IsAny <int>())).Returns(new List <OrgFunding> {
                new OrgFunding()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.LatestEFADisadvantagesUpliftForPostcode(learner.Postcode)).Returns(1.0m);
            fileDataServiceMock.Setup(dp => dp.DPOutcomesForLearnRefNumber(learner.LearnRefNumber)).Returns(dpOutcome);

            return(new DataEntityMapper(
                       larsRefererenceDataServiceMock.Object,
                       organisationRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object,
                       fileDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
Beispiel #27
0
        public IDataEntity GetDataEntityMapperEntity()
        {
            var larsRefererenceDataServiceMock    = new Mock <ILARSReferenceDataService>();
            var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();
            var fileDataServiceMock = new Mock <IFileDataService>();

            var learner = new TestLearner
            {
                LearnRefNumber            = "Learner1",
                ULN                       = 1234567890,
                PostcodePrior             = "Postcode",
                LearnerEmploymentStatuses = new List <TestLearnerEmploymentStatus>
                {
                    new TestLearnerEmploymentStatus
                    {
                        AgreeId        = "1",
                        DateEmpStatApp = new DateTime(2018, 8, 1),
                        EmpStat        = 2
                    }
                },
                LearningDeliveries = new List <TestLearningDelivery>
                {
                    new TestLearningDelivery
                    {
                        LearnAimRef          = "1",
                        AimSeqNumber         = 2,
                        AimType              = 3,
                        CompStatus           = 4,
                        PwayCodeNullable     = 5,
                        ProgTypeNullable     = 6,
                        FworkCodeNullable    = 7,
                        FundModel            = 99,
                        StdCodeNullable      = 8,
                        LearnStartDate       = new DateTime(2018, 8, 1),
                        LearnPlanEndDate     = new DateTime(2019, 8, 1),
                        DelLocPostCode       = "Postcode",
                        LearningDeliveryFAMs = new List <TestLearningDeliveryFAM>
                        {
                            new TestLearningDeliveryFAM()
                        },
                        AppFinRecords = new List <TestAppFinRecord>
                        {
                            new TestAppFinRecord()
                        }
                    }
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                LARSCareerLearningPilot = new List <LARSCareerLearningPilot>
                {
                    new LARSCareerLearningPilot()
                }
            };

            var larsFunding = new List <LARSFunding>
            {
                new LARSFunding()
            };

            var learningDelivery = learner.LearningDeliveries.First();

            larsRefererenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);
            larsRefererenceDataServiceMock.Setup(l => l.LARSFundingsForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsFunding);
            postcodesReferenceDataServiceMock.Setup(p => p.SFAAreaCostsForPostcode(learningDelivery.DelLocPostCode)).Returns(new List <SfaAreaCost> {
                new SfaAreaCost()
            });
            postcodesReferenceDataServiceMock.Setup(p => p.CareerLearningPilotsForPostcode(learningDelivery.DelLocPostCode)).Returns(new List <CareerLearningPilot> {
                new CareerLearningPilot()
            });

            return(new DataEntityMapper(
                       larsRefererenceDataServiceMock.Object,
                       postcodesReferenceDataServiceMock.Object,
                       fileDataServiceMock.Object).BuildGlobalDataEntity(learner, new Global()));
        }
Beispiel #28
0
        public void MapTo()
        {
            var ukprn           = 1;
            var larsVersion     = "1.0.0";
            var orgVersion      = "1.0.0";
            var postcodeVersion = "1.0.0";
            var learnAimRef     = "LearnAimRef";
            var postcodePrior   = "Postcode";
            var delLocPostcode  = "Postcode";
            var empId           = 1;

            var global = new Global
            {
                LARSVersion = larsVersion,
                UKPRN       = ukprn,
                OrgVersion  = orgVersion,
                PostcodeDisadvantageVersion = postcodeVersion
            };

            var learnerDtos = new List <FM35LearnerDto>
            {
                new FM35LearnerDto
                {
                    PostcodePrior             = postcodePrior,
                    LearnerEmploymentStatuses = new List <LearnerEmploymentStatus>
                    {
                        new LearnerEmploymentStatus
                        {
                            EmpId = empId
                        }
                    },
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef    = learnAimRef,
                            FundModel      = 35,
                            DelLocPostCode = delLocPostcode
                        }
                    }
                },
                new FM35LearnerDto
                {
                    PostcodePrior             = postcodePrior,
                    LearnerEmploymentStatuses = new List <LearnerEmploymentStatus>
                    {
                        new LearnerEmploymentStatus
                        {
                            EmpId = empId
                        }
                    },
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef = learnAimRef,
                            FundModel   = 35,
                        }
                    }
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode         = "awardOrgCode",
                EFACOFType           = 1,
                LearnAimRefTitle     = "learnAimRefTitle",
                LearnAimRefType      = "learnAimRefType",
                RegulatedCreditValue = 2,
                NotionalNVQLevelv2   = "NVQLevel",
                LARSFundings         = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2019, 1, 1),
                        EffectiveTo     = new DateTime(2020, 1, 1),
                    }
                }
            };

            var larsStandard = new LARSStandard
            {
                StandardCode = 1,
            };

            IEnumerable <DasDisadvantage> dasDisadvantage = new List <DasDisadvantage>
            {
                new DasDisadvantage
                {
                    Postcode      = "DelLocPostcode",
                    EffectiveFrom = new DateTime(2019, 1, 1),
                    EffectiveTo   = new DateTime(2020, 1, 1),
                    Uplift        = 1.2m
                }
            };

            var largeEmployersReferenceDataServiceMock = new Mock <ILargeEmployersReferenceDataService>();
            var larsReferenceDataServiceMock           = new Mock <ILARSReferenceDataService>();
            var orgReferenceDataServiceMock            = new Mock <IOrganisationReferenceDataService>();
            var postcodesReferenceDataServiceMock      = new Mock <IPostcodesReferenceDataService>();

            largeEmployersReferenceDataServiceMock.Setup(l => l.LargeEmployersforEmpID(empId)).Returns(new List <LargeEmployers> {
                new LargeEmployers()
            });
            larsReferenceDataServiceMock.Setup(l => l.LARSCurrentVersion()).Returns(global.LARSVersion);
            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learnAimRef)).Returns(larsLearningDelivery);
            orgReferenceDataServiceMock.Setup(o => o.OrganisationFundingForUKPRN(global.UKPRN)).Returns(new List <OrgFunding> {
                new OrgFunding()
            });
            postcodesReferenceDataServiceMock.Setup(o => o.SFADisadvantagesForPostcode(postcodePrior)).Returns(new List <SfaDisadvantage>());

            var dataEntities = NewService(
                largeEmployersReferenceDataServiceMock.Object,
                larsReferenceDataServiceMock.Object,
                orgReferenceDataServiceMock.Object,
                postcodesReferenceDataServiceMock.Object)
                               .MapTo(ukprn, learnerDtos);

            dataEntities.Should().HaveCount(2);
            dataEntities.SelectMany(d => d.Children).Should().NotBeNullOrEmpty();
        }
Beispiel #29
0
        public void BuildLearningDelivery()
        {
            var learningDelivery = new LearningDelivery()
            {
                AimSeqNumber         = 1,
                AchDate              = new DateTime(2019, 8, 1),
                AimType              = 2,
                CompStatus           = 3,
                DelLocPostCode       = "DelLocPostcode",
                FundModel            = 4,
                FworkCode            = 5,
                LearnActEndDate      = new DateTime(2018, 1, 1),
                LearnAimRef          = "LearnAimRef",
                LearnPlanEndDate     = new DateTime(2019, 1, 1),
                LearnStartDate       = new DateTime(2020, 1, 1),
                OrigLearnStartDate   = new DateTime(2020, 1, 1),
                OtherFundAdj         = 6,
                Outcome              = 7,
                PriorLearnFundAdj    = 8,
                ProgType             = 9,
                PwayCode             = 10,
                StdCode              = 11,
                LearningDeliveryFAMs = new List <LearningDeliveryFAM>()
                {
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "EEF", LearnDelFAMCode = "EEF"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM1"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM2"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM3"
                    },
                    new LearningDeliveryFAM()
                    {
                        LearnDelFAMType = "LDM", LearnDelFAMCode = "LDM4"
                    }
                }
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode             = "awardOrgCode",
                EFACOFType               = 1,
                FrameworkCommonComponent = 2,
                LearnAimRefTitle         = "learnAimRefTitle",
                LearnAimRefType          = "learnAimRefType",
                RegulatedCreditValue     = 3,
                NotionalNVQLevelv2       = "NVQLevel",
                LARSFundings             = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2019, 1, 1),
                        EffectiveTo     = new DateTime(2020, 1, 1),
                    }
                },
            };

            var larsReferenceDataServiceMock = new Mock <ILARSReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learningDelivery.LearnAimRef)).Returns(larsLearningDelivery);

            var dataEntity = NewService(larsReferenceDataServiceMock.Object).BuildLearningDeliveryDataEntity(learningDelivery);

            dataEntity.EntityName.Should().Be("LearningDelivery");
            dataEntity.Attributes.Should().HaveCount(16);
            dataEntity.Attributes["AimSeqNumber"].Value.Should().Be(learningDelivery.AimSeqNumber);
            dataEntity.Attributes["AchDate"].Value.Should().Be(learningDelivery.AchDate);
            dataEntity.Attributes["AimType"].Value.Should().Be(learningDelivery.AimType);
            dataEntity.Attributes["CompStatus"].Value.Should().Be(learningDelivery.CompStatus);
            dataEntity.Attributes["FrameworkCommonComponent"].Value.Should().Be(2);
            dataEntity.Attributes["FworkCode"].Value.Should().Be(learningDelivery.FworkCode);
            dataEntity.Attributes["LearnAimRef"].Value.Should().Be(learningDelivery.LearnAimRef);
            dataEntity.Attributes["LearnActEndDate"].Value.Should().Be(learningDelivery.LearnActEndDate);
            dataEntity.Attributes["LearnPlanEndDate"].Value.Should().Be(learningDelivery.LearnPlanEndDate);
            dataEntity.Attributes["LearnStartDate"].Value.Should().Be(learningDelivery.LearnStartDate);
            dataEntity.Attributes["OrigLearnStartDate"].Value.Should().Be(learningDelivery.OrigLearnStartDate);
            dataEntity.Attributes["OtherFundAdj"].Value.Should().Be(learningDelivery.OtherFundAdj);
            dataEntity.Attributes["PriorLearnFundAdj"].Value.Should().Be(learningDelivery.PriorLearnFundAdj);
            dataEntity.Attributes["ProgType"].Value.Should().Be(learningDelivery.ProgType);
            dataEntity.Attributes["PwayCode"].Value.Should().Be(learningDelivery.PwayCode);
            dataEntity.Attributes["STDCode"].Value.Should().Be(learningDelivery.StdCode);
        }
Beispiel #30
0
        public void MapTo()
        {
            var ukprn          = 1;
            var learnAimRef    = "LearnAImRef";
            var delLocPostCode = "Postcode";

            var global = new Global
            {
                LARSVersion      = "1.0.0",
                PostcodesVersion = "2.0.0",
                UKPRN            = 1234
            };

            var learnerDtos = new List <ALBLearnerDto>
            {
                new ALBLearnerDto
                {
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef    = learnAimRef,
                            DelLocPostCode = delLocPostCode,
                            FundModel      = 99
                        }
                    }
                },
                new ALBLearnerDto
                {
                    LearningDeliveries = new List <LearningDelivery>
                    {
                        new LearningDelivery
                        {
                            LearnAimRef    = learnAimRef,
                            DelLocPostCode = delLocPostCode,
                            FundModel      = 99
                        }
                    }
                },
            };

            var larsLearningDelivery = new LARSLearningDelivery
            {
                AwardOrgCode         = "awardOrgCode",
                EFACOFType           = 1,
                LearnAimRefTitle     = "learnAimRefTitle",
                LearnAimRefType      = "learnAimRefType",
                RegulatedCreditValue = 2,
                NotionalNVQLevelv2   = "NVQLevel",
                LARSFundings         = new List <LARSFunding>
                {
                    new LARSFunding
                    {
                        FundingCategory = "Matrix",
                        RateWeighted    = 1.0m,
                        WeightingFactor = "G",
                        EffectiveFrom   = new DateTime(2019, 1, 1),
                        EffectiveTo     = new DateTime(2020, 1, 1),
                    }
                },
            };

            var sfaAreaCost = new List <SfaAreaCost>
            {
                new SfaAreaCost
                {
                    Postcode       = "DelLocPostcode",
                    EffectiveFrom  = new DateTime(2019, 1, 1),
                    EffectiveTo    = new DateTime(2020, 1, 1),
                    AreaCostFactor = 1.2m
                }
            };

            var larsReferenceDataServiceMock     = new Mock <ILARSReferenceDataService>();
            var postcodeReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>();

            larsReferenceDataServiceMock.Setup(l => l.LARSCurrentVersion()).Returns(global.LARSVersion);
            postcodeReferenceDataServiceMock.Setup(o => o.PostcodesCurrentVersion()).Returns(global.PostcodesVersion);

            larsReferenceDataServiceMock.Setup(l => l.LARSLearningDeliveryForLearnAimRef(learnAimRef)).Returns(larsLearningDelivery);
            postcodeReferenceDataServiceMock.Setup(o => o.SFAAreaCostsForPostcode(delLocPostCode)).Returns(sfaAreaCost);

            var dataEntities = NewService(larsReferenceDataServiceMock.Object, postcodeReferenceDataServiceMock.Object).MapTo(ukprn, learnerDtos);

            dataEntities.Should().HaveCount(2);
            dataEntities.SelectMany(d => d.Children).Should().NotBeNullOrEmpty();
        }