public IEnumerable <ALB_LearningDelivery> MapLearningDeliveries(ALBGlobal albGlobal) { return(albGlobal.Learners .SelectMany(l => l.LearningDeliveries.Select(ld => new ALB_LearningDelivery { UKPRN = albGlobal.UKPRN, LearnRefNumber = l.LearnRefNumber, AimSeqNumber = ld.AimSeqNumber, Achieved = ld.LearningDeliveryValue.Achieved, ActualNumInstalm = ld.LearningDeliveryValue.ActualNumInstalm, AdvLoan = ld.LearningDeliveryValue.AdvLoan, ApplicFactDate = ld.LearningDeliveryValue.ApplicFactDate, ApplicProgWeightFact = ld.LearningDeliveryValue.ApplicProgWeightFact, AreaCostFactAdj = ld.LearningDeliveryValue.AreaCostFactAdj, AreaCostInstalment = ld.LearningDeliveryValue.AreaCostInstalment, FundLine = ld.LearningDeliveryValue.FundLine, FundStart = ld.LearningDeliveryValue.FundStart, LearnDelApplicLARSCarPilFundSubRate = ld.LearningDeliveryValue.LearnDelApplicLARSCarPilFundSubRate, LearnDelApplicSubsidyPilotAreaCode = ld.LearningDeliveryValue.LearnDelApplicSubsidyPilotAreaCode, LearnDelCarLearnPilotAimValue = ld.LearningDeliveryValue.LearnDelCarLearnPilotAimValue, LearnDelCarLearnPilotInstalAmount = ld.LearningDeliveryValue.LearnDelCarLearnPilotInstalAmount, LearnDelEligCareerLearnPilot = ld.LearningDeliveryValue.LearnDelEligCareerLearnPilot, LiabilityDate = ld.LearningDeliveryValue.LiabilityDate, LoanBursAreaUplift = ld.LearningDeliveryValue.LoanBursAreaUplift, LoanBursSupp = ld.LearningDeliveryValue.LoanBursSupp, OutstndNumOnProgInstalm = ld.LearningDeliveryValue.OutstndNumOnProgInstalm, PlannedNumOnProgInstalm = ld.LearningDeliveryValue.PlannedNumOnProgInstalm, WeightedRate = ld.LearningDeliveryValue.WeightedRate, }))); }
public IEnumerable <ALB_Learner_PeriodisedValue> MapLearnerPeriodisedValues(ALBGlobal albGlobal) { var periodisedValues = albGlobal.Learners.Select(l => new FundModelLearnerPeriodisedValue <List <LearnerPeriodisedValue> >(albGlobal.UKPRN, l.LearnRefNumber, l.LearnerPeriodisedValues)); return (periodisedValues.SelectMany(pv => pv.LearnerPeriodisedValue .Select(p => new ALB_Learner_PeriodisedValue { UKPRN = pv.Ukprn, LearnRefNumber = pv.LearnRefNumber, AttributeName = p.AttributeName, Period_1 = p.Period1, Period_2 = p.Period2, Period_3 = p.Period3, Period_4 = p.Period4, Period_5 = p.Period5, Period_6 = p.Period6, Period_7 = p.Period7, Period_8 = p.Period8, Period_9 = p.Period9, Period_10 = p.Period10, Period_11 = p.Period11, Period_12 = p.Period12 }))); }
public IEnumerable <ALB_LearningDelivery_Period> MapLearningDeliveryPeriods(ALBGlobal albGlobal) { var periodisedValues = albGlobal.Learners .SelectMany(l => l.LearningDeliveries.Select(ld => new FundModelLearningDeliveryPeriodisedValue <List <LearningDeliveryPeriodisedValue> >(albGlobal.UKPRN, l.LearnRefNumber, ld.AimSeqNumber, ld.LearningDeliveryPeriodisedValues))); var learningDeliveryPeriods = new List <ALB_LearningDelivery_Period>(); for (var i = 1; i < 13; i++) { learningDeliveryPeriods.AddRange( periodisedValues.Select(pv => new ALB_LearningDelivery_Period { UKPRN = pv.Ukprn, LearnRefNumber = pv.LearnRefNumber, AimSeqNumber = pv.AimSeqNumber, Period = i, ALBCode = PeriodisedValueHelper.GetPeriodValue <LearningDeliveryPeriodisedValue, int?>(pv.LearningDeliveryPeriodisedValue.FirstOrDefault(a => a.AttributeName == ALBConstants.ALBCode), i), ALBSupportPayment = PeriodisedValueHelper.GetPeriodValue <LearningDeliveryPeriodisedValue, decimal?>(pv.LearningDeliveryPeriodisedValue.FirstOrDefault(a => a.AttributeName == ALBConstants.ALBSupportPayment), i), AreaUpliftBalPayment = PeriodisedValueHelper.GetPeriodValue <LearningDeliveryPeriodisedValue, decimal?>(pv.LearningDeliveryPeriodisedValue.FirstOrDefault(a => a.AttributeName == ALBConstants.AreaUpliftBalPayment), i), AreaUpliftOnProgPayment = PeriodisedValueHelper.GetPeriodValue <LearningDeliveryPeriodisedValue, decimal?>(pv.LearningDeliveryPeriodisedValue.FirstOrDefault(a => a.AttributeName == ALBConstants.AreaUpliftOnProgPayment), i), LearnDelCarLearnPilotBalPayment = PeriodisedValueHelper.GetPeriodValue <LearningDeliveryPeriodisedValue, decimal?>(pv.LearningDeliveryPeriodisedValue.FirstOrDefault(a => a.AttributeName == ALBConstants.LearnDelCarLearnPilotBalPayment), i), LearnDelCarLearnPilotOnProgPayment = PeriodisedValueHelper.GetPeriodValue <LearningDeliveryPeriodisedValue, decimal?>(pv.LearningDeliveryPeriodisedValue.FirstOrDefault(a => a.AttributeName == ALBConstants.LearnDelCarLearnPilotOnProgPayment), i) })); } return(learningDeliveryPeriods); }
public void Condense_NullLearners() { var globalOne = new ALBGlobal() { Learners = null }; var globalTwo = new ALBGlobal() { Learners = null }; var globalThree = new ALBGlobal() { Learners = null }; var fundingOutputs = new List <ALBGlobal>() { globalOne, globalTwo, globalThree, }; var fundingOutput = NewService().Condense(fundingOutputs); fundingOutput.Should().Be(globalOne); fundingOutput.Learners.Should().BeEmpty(); }
public IEnumerable <ALB_Learner> MapLearners(ALBGlobal albGlobal) { return(albGlobal.Learners.Select(l => new ALB_Learner { UKPRN = albGlobal.UKPRN, LearnRefNumber = l.LearnRefNumber })); }
public void Condense_EmptyCollection() { var global = new ALBGlobal { UKPRN = 1 }; NewService().Condense(Enumerable.Empty <ALBGlobal>(), 1, "2021").Should().BeEquivalentTo(global); }
public async Task <string> Process(FundingDto actorModel, CancellationToken cancellationToken) { ALBGlobal results = RunFunding(actorModel, cancellationToken); actorModel = null; GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true, true); return(BuildFundingOutput(results)); }
public void MapALBData(IDataStoreCache cache, ALBGlobal albGlobal) { var learners = albGlobal?.Learners; if (learners == null) { return; } var ukprn = albGlobal.UKPRN; PopulateDataStoreCache(cache, learners, albGlobal, ukprn); }
public IEnumerable <ALB_global> MapGlobals(ALBGlobal albGlobal) { return(new List <ALB_global>() { new ALB_global { UKPRN = albGlobal.UKPRN, LARSVersion = albGlobal.LARSVersion, PostcodeAreaCostVersion = albGlobal.PostcodeAreaCostVersion, RulebaseVersion = albGlobal.RulebaseVersion } }); }
public List <ALB_global> BuildGlobals(ALBGlobal albGlobal, int ukprn) { return(new List <ALB_global>() { new ALB_global { UKPRN = ukprn, LARSVersion = albGlobal.LARSVersion, PostcodeAreaCostVersion = albGlobal.PostcodeAreaCostVersion, RulebaseVersion = albGlobal.RulebaseVersion } }); }
public void Condense() { var learnerOne = new ALBLearner(); var learnerTwo = new ALBLearner(); var learnerThree = new ALBLearner(); var learnerFour = new ALBLearner(); var learnerFive = new ALBLearner(); var learnerSix = new ALBLearner(); var globalOne = new ALBGlobal() { Learners = new List <ALBLearner>() { learnerOne, learnerTwo, }, }; var globalTwo = new ALBGlobal() { Learners = new List <ALBLearner> { learnerThree, learnerFour, }, }; var globalThree = new ALBGlobal() { Learners = new List <ALBLearner> { learnerFive, learnerSix, }, }; var fundingOutputs = new List <ALBGlobal>() { globalOne, globalTwo, globalThree, }; var fundingOutput = NewService().Condense(fundingOutputs); fundingOutput.Should().Be(globalOne); fundingOutput.Learners.Should().HaveCount(6); fundingOutput.Learners.Should().Contain(new[] { learnerOne, learnerTwo, learnerThree, learnerFour, learnerFive, learnerSix }); }
public AllbProviderService( ILogger logger, IStreamableKeyValuePersistenceService storage, IJsonSerializationService jsonSerializationService, IIntUtilitiesService intUtilitiesService, Func <IIlr1819ValidContext> ilrValidContextFactory, Func <IIlr1819RulebaseContext> ilrRulebaseContextFactory) { _logger = logger; _storage = storage; _jsonSerializationService = jsonSerializationService; _intUtilitiesService = intUtilitiesService; _ilrValidContextFactory = ilrValidContextFactory; _ilrRulebaseContextFactory = ilrRulebaseContextFactory; _fundingOutputs = null; _getDataLock = new SemaphoreSlim(1, 1); }
public async Task Execute() { var cancellationToken = CancellationToken.None; var fundingServiceContextMock = new Mock <IFundingServiceContext>(); fundingServiceContextMock.Setup(f => f.JobId).Returns(1); fundingServiceContextMock.Setup(f => f.Container).Returns("Container"); fundingServiceContextMock.Setup(f => f.FundingFm36OutputKey).Returns("Key"); fundingServiceContextMock.Setup(f => f.Ukprn).Returns(12345678); fundingServiceContextMock.Setup(f => f.Year).Returns("1920"); IEnumerable <FundingDto> fundingActorDtos = new List <FundingDto> { new FundingDto() }; var albActor = new Mock <IALBActor>(); var condenserOutput = new ALBGlobal(); var jsonSerializationServiceMock = new Mock <IJsonSerializationService>(); var fundingActorProviderMock = new Mock <IActorProvider <IALBActor> >(); var filePersistanceServiceMock = new Mock <IFilePersistanceService>(); var fundingOutputCondenserServiceMock = new Mock <IFundingOutputCondenserService <ALBGlobal> >(); var loggerMock = new Mock <ILogger>(); albActor.Setup(a => a.Process(fundingActorDtos.FirstOrDefault(), cancellationToken)).Returns(() => Task <string> .Factory.StartNew(() => "string")); jsonSerializationServiceMock.Setup(sm => sm.Deserialize <ALBGlobal>(It.IsAny <string>())).Returns(new ALBGlobal()).Verifiable(); fundingActorProviderMock.Setup(pm => pm.Provide()).Returns(albActor.Object).Verifiable(); filePersistanceServiceMock.Setup(sm => sm.PersistAsync(fundingServiceContextMock.Object.FundingALBOutputKey, fundingServiceContextMock.Object.Container, condenserOutput, cancellationToken)).Returns(Task.CompletedTask).Verifiable(); fundingOutputCondenserServiceMock.Setup(sm => sm.Condense( It.IsAny <IEnumerable <ALBGlobal> >(), fundingServiceContextMock.Object.Ukprn, fundingServiceContextMock.Object.Year)).Returns(condenserOutput).Verifiable(); await NewTask( jsonSerializationServiceMock.Object, fundingActorProviderMock.Object, filePersistanceServiceMock.Object, fundingOutputCondenserServiceMock.Object, loggerMock.Object, "ALBActor").Execute(fundingActorDtos, fundingServiceContextMock.Object, cancellationToken); fundingActorProviderMock.VerifyAll(); filePersistanceServiceMock.VerifyAll(); fundingOutputCondenserServiceMock.VerifyAll(); }
public ALBData MapALBData(ALBGlobal albGlobal) { var data = new ALBData(); if (albGlobal.Learners != null) { data.Globals = MapGlobals(albGlobal).ToList(); data.Learners = MapLearners(albGlobal).ToList(); data.LearnerPeriodisedValues = MapLearnerPeriodisedValues(albGlobal).ToList(); data.LearnerPeriods = MapLearnerPeriods(albGlobal).ToList(); data.LearningDeliveries = MapLearningDeliveries(albGlobal).ToList(); data.LearningDeliveryPeriodisedValues = MapLearningDeliveryPeriodisedValues(albGlobal).ToList(); data.LearningDeliveryPeriods = MapLearningDeliveryPeriods(albGlobal).ToList(); } return(data); }
public void MapFM99() { var fundLine1 = "FundLine1"; var fundLine2 = "FundLine2"; var attribute1 = "Attribute1"; var attribute2 = "Attribute2"; var global = new ALBGlobal() { Learners = Enumerable.Range(0, 1000) .Select(i => new ALBLearner() { LearningDeliveries = Enumerable.Range(0, 3) .Select(j => new ESFA.DC.ILR.ReportService.Models.Fm99.LearningDelivery() { LearningDeliveryValue = new ESFA.DC.ILR.ReportService.Models.Fm99.LearningDeliveryValue() { FundLine = j % 2 == 0 ? fundLine1 : fundLine2 }, LearningDeliveryPeriodisedValues = Enumerable.Range(0, 16) .Select(k => new ESFA.DC.ILR.ReportService.Models.Fm99.LearningDeliveryPeriodisedValue() { AttributeName = k % 2 == 0 ? attribute1 : attribute2 }).ToList(), }).ToList(), }).ToList() }; var mapped = NewProvider().BuildFm99Dictionary(global); mapped.Should().HaveCount(2); mapped[fundLine1].Should().HaveCount(2); mapped[fundLine2].Should().HaveCount(2); mapped[fundLine1][attribute1].Should().HaveCount(16000); mapped[fundLine1][attribute2].Should().HaveCount(16000); mapped[fundLine2][attribute1].Should().HaveCount(8000); mapped[fundLine2][attribute2].Should().HaveCount(8000); }
public IEnumerable <ALB_Learner_Period> MapLearnerPeriods(ALBGlobal albGlobal) { var periodisedValues = albGlobal.Learners.Select(l => new FundModelLearnerPeriodisedValue <List <LearnerPeriodisedValue> >(albGlobal.UKPRN, l.LearnRefNumber, l.LearnerPeriodisedValues)); var learnerPeriods = new List <ALB_Learner_Period>(); for (var i = 1; i < 13; i++) { learnerPeriods.AddRange( periodisedValues.Select(pv => new ALB_Learner_Period { UKPRN = pv.Ukprn, LearnRefNumber = pv.LearnRefNumber, Period = i, ALBSeqNum = PeriodisedValueHelper.GetPeriodValue <LearnerPeriodisedValue, int?>(pv.LearnerPeriodisedValue.FirstOrDefault(a => a.AttributeName == ALBConstants.ALBSeqNum), i), })); } return(learnerPeriods); }
public async Task StoreAsync() { var cancellationToken = CancellationToken.None; var fileReference = "FileReference"; var container = "Container"; var albGLobal = new ALBGlobal(); Stream stream = new MemoryStream(); var fileServiceMock = new Mock <IFileService>(); var jsonSerializationServiceMock = new Mock <IJsonSerializationService>(); fileServiceMock.Setup(s => s.OpenWriteStreamAsync(fileReference, container, cancellationToken)).Returns(Task.FromResult(stream)).Verifiable(); jsonSerializationServiceMock.Setup(s => s.Serialize(albGLobal, It.IsAny <Stream>())).Verifiable(); await NewService(jsonSerializationServiceMock.Object, fileServiceMock.Object).PersistAsync(fileReference, container, albGLobal, cancellationToken); fileServiceMock.VerifyAll(); jsonSerializationServiceMock.VerifyAll(); }
public ALBData MapALBData(ALBGlobal albGlobal) => _albMapper.MapALBData(albGlobal);
public IEnumerable <ALB_Learner_Period> MapLearnerPeriods(ALBGlobal albGlobal) { return(new List <ALB_Learner_Period>()); }
public IEnumerable <ALB_Learner_PeriodisedValue> MapLearnerPeriodisedValues(ALBGlobal albGlobal) { return(new List <ALB_Learner_PeriodisedValue>()); }
public IEnumerable <ALB_LearningDelivery> MapLearningDeliveries(ALBGlobal albGlobal) { return(new List <ALB_LearningDelivery>()); }
public IEnumerable <ALB_LearningDelivery_PeriodisedValue> MapLearningDeliveryPeriodisedValues(ALBGlobal albGlobal) { return(new List <ALB_LearningDelivery_PeriodisedValue>()); }
public void MapALBData(IDataStoreCache cache, ALBGlobal albGlobal) => _albMapper.MapALBData(cache, albGlobal);
private async Task <Tuple <Message, ALBGlobal, ValidationErrorDto[], IDataStoreContext> > ReadAndDeserialiseAsync( string ilrFilename, string albFilename, string valErrorsDtoFilename, List <string> validLearners, Mock <IKeyValuePersistenceService> storage, Mock <IKeyValuePersistenceService> persist, Mock <ISerializationService> serialise, Mock <IValidationErrorsService> validationErrorsService) { var xmlSerialiser = new XmlSerializationService(); var jsonSerialiser = new JsonSerializationService(); const string validLearnersKey = "ValidLearners"; const string validLearnersSerialised = "<Serialised String>"; const string keyAlbOutput = "ALB_Output"; const string keyValErrors = "ValErrors"; const string keyValErrorsLookup = "ValErrorsLookup"; string ilrContents, albContents, valErrorsContents; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (StreamReader sr = new StreamReader(ilrFilename)) { ilrContents = await sr.ReadToEndAsync(); } output.WriteLine($"Read ILR file: {stopwatch.ElapsedMilliseconds}"); stopwatch.Restart(); using (StreamReader sr = new StreamReader(albFilename)) { albContents = await sr.ReadToEndAsync(); } output.WriteLine($"Read ALB file: {stopwatch.ElapsedMilliseconds}"); stopwatch.Restart(); using (StreamReader sr = new StreamReader(valErrorsDtoFilename)) { valErrorsContents = await sr.ReadToEndAsync(); } output.WriteLine($"Read Val Errors file: {stopwatch.ElapsedMilliseconds}"); stopwatch.Restart(); Message message = xmlSerialiser.Deserialize <Message>(ilrContents); output.WriteLine($"Deserialise ILR: {stopwatch.ElapsedMilliseconds}"); stopwatch.Restart(); ALBGlobal fundingOutputs = jsonSerialiser.Deserialize <ALBGlobal>(albContents); output.WriteLine($"Deserialise ALB: {stopwatch.ElapsedMilliseconds}"); stopwatch.Restart(); ValidationErrorDto[] validationErrorDtos = jsonSerialiser.Deserialize <ValidationErrorDto[]>(valErrorsContents); output.WriteLine($"Deserialise Val: {stopwatch.ElapsedMilliseconds}"); stopwatch.Restart(); var dataStoreContextMock = new Mock <IDataStoreContext>(); dataStoreContextMock.SetupGet(c => c.Filename).Returns(Path.GetFileName(ilrFilename)); dataStoreContextMock.SetupGet(c => c.OriginalFilename).Returns(Path.GetFileName(ilrFilename)); dataStoreContextMock.SetupGet(c => c.ValidLearnRefNumbersKey).Returns(validLearnersKey); dataStoreContextMock.SetupGet(c => c.FileSizeInBytes).Returns(new FileInfo(ilrFilename).Length); dataStoreContextMock.SetupGet(c => c.Ukprn).Returns(message.HeaderEntity.SourceEntity.UKPRN); dataStoreContextMock.SetupGet(c => c.ValidLearnRefNumbersCount).Returns(validLearners.Count); dataStoreContextMock.SetupGet(c => c.InvalidLearnRefNumbersCount).Returns(message.Learner.Length - validLearners.Count); dataStoreContextMock.SetupGet(c => c.ValidationTotalErrorCount).Returns(10); dataStoreContextMock.SetupGet(c => c.ValidationTotalWarningCount).Returns(20); dataStoreContextMock.SetupGet(c => c.FundingALBOutputKey).Returns(keyAlbOutput); dataStoreContextMock.SetupGet(c => c.ValidationErrorsKey).Returns(keyValErrors); dataStoreContextMock.SetupGet(c => c.ValidationErrorsLookupsKey).Returns(keyValErrorsLookup); dataStoreContextMock.SetupGet(c => c.SubmissionDateTimeUtc).Returns(new DateTime(2018, 1, 1)); storage.Setup(x => x.GetAsync(Path.GetFileName(ilrFilename), It.IsAny <CancellationToken>())).ReturnsAsync(ilrContents); // storage.Setup(x => x.GetAsync(Path.GetFileName(albFilename))).ReturnsAsync(albContents); persist.Setup(x => x.GetAsync(validLearnersKey, It.IsAny <CancellationToken>())).ReturnsAsync(validLearnersSerialised); persist.Setup(x => x.GetAsync(keyAlbOutput, It.IsAny <CancellationToken>())).ReturnsAsync(albContents); serialise.Setup(x => x.Deserialize <List <string> >(validLearnersSerialised)).Returns(validLearners); serialise.Setup(x => x.Deserialize <Message>(ilrContents)).Returns(message); serialise.Setup(x => x.Deserialize <ALBGlobal>(albContents)).Returns(fundingOutputs); validationErrorsService.Setup(x => x.GetValidationErrorsAsync(keyValErrors, keyValErrorsLookup)) .ReturnsAsync(validationErrorDtos); output.WriteLine($"Moq: {stopwatch.ElapsedMilliseconds}"); return(new Tuple <Message, ALBGlobal, ValidationErrorDto[], IDataStoreContext>(message, fundingOutputs, validationErrorDtos, dataStoreContextMock.Object)); }
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); }
public void Build_FiftyThousandLearners() { var reportServiceContext = Mock.Of <IReportServiceContext>(); var dependentDataMock = new Mock <IReportServiceDependentData>(); var ilrModelMapperMock = new Mock <IIlrModelMapper>(); var providerSpecDeliveryMonitoring = new ProviderSpecDeliveryMonitoringModel(); var providerSpecLearnMonitoring = new ProviderSpecLearnerMonitoringModel(); var famModel = new LearningDeliveryFAMsModel(); ilrModelMapperMock.Setup(m => m.MapProviderSpecDeliveryMonitorings(It.IsAny <IEnumerable <IProviderSpecDeliveryMonitoring> >())).Returns(providerSpecDeliveryMonitoring); ilrModelMapperMock.Setup(m => m.MapProviderSpecLearnerMonitorings(It.IsAny <IEnumerable <IProviderSpecLearnerMonitoring> >())).Returns(providerSpecLearnMonitoring); ilrModelMapperMock.Setup(m => m.MapLearningDeliveryFAMs(It.IsAny <IEnumerable <ILearningDeliveryFAM> >())).Returns(famModel); var learnerCount = 50000; var message = new TestMessage() { Learners = Enumerable.Range(0, learnerCount).Select( l => new TestLearner() { LearnRefNumber = "LearnRefNumber" + l, LearningDeliveries = new List <ILearningDelivery>() { new TestLearningDelivery() { FundModel = 99, LearnAimRef = "learnAimRef" + l, AimSeqNumber = 1, LearningDeliveryFAMs = new List <ILearningDeliveryFAM>() { new TestLearningDeliveryFAM() { LearnDelFAMType = "ADL", LearnDelFAMCode = "1", }, new TestLearningDeliveryFAM() { LearnDelFAMType = "ALB", } } } } }).ToList() }; var referenceDataRoot = new ReferenceDataRoot() { LARSLearningDeliveries = Enumerable.Range(0, learnerCount) .Select(ld => new LARSLearningDelivery() { LearnAimRef = "learnAimRef" + ld }).ToList() }; var albGlobal = new ALBGlobal() { Learners = Enumerable.Range(0, learnerCount) .Select( l => new ALBLearner() { LearnRefNumber = "LearnRefNumber" + l, LearningDeliveries = new List <LearningDelivery>() { new LearningDelivery() { AimSeqNumber = 1, LearningDeliveryValue = new LearningDeliveryValue(), LearningDeliveryPeriodisedValues = new List <LearningDeliveryPeriodisedValue>() { BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35OnProgPayment), BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35AchievePayPct), BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35AchievePayment), BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35EmpOutcomePay), BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35BalancePayment), BuildPeriodisedValuesForAttribute(AttributeConstants.Fm35LearnSuppFundCash), } } } }).ToList() }; dependentDataMock.Setup(d => d.Get <IMessage>()).Returns(message); dependentDataMock.Setup(d => d.Get <ReferenceDataRoot>()).Returns(referenceDataRoot); dependentDataMock.Setup(d => d.Get <ALBGlobal>()).Returns(albGlobal); var result = NewBuilder(ilrModelMapperMock.Object).Build(reportServiceContext, dependentDataMock.Object).ToList(); result.Should().HaveCount(learnerCount); }
private static List <ALBLearningDeliveryValues> GetAlbLearningDeliveryPeriodisedValues(ALBGlobal albGlobal, int ukPrn) { var result = new List <ALBLearningDeliveryValues>(); if (albGlobal?.Learners == null) { return(result); } foreach (var learner in albGlobal.Learners) { if (learner.LearningDeliveries == null) { continue; } foreach (var ld in learner.LearningDeliveries) { if (ld.LearningDeliveryPeriodisedValues == null) { continue; } foreach (var ldpv in ld.LearningDeliveryPeriodisedValues) { result.Add(new ALBLearningDeliveryValues { AimSeqNumber = ld.AimSeqNumber, LearnRefNumber = learner.LearnRefNumber, AttributeName = ldpv.AttributeName, Period1 = ldpv.Period1, Period2 = ldpv.Period2, Period3 = ldpv.Period3, Period4 = ldpv.Period4, Period5 = ldpv.Period5, Period6 = ldpv.Period6, Period7 = ldpv.Period7, Period8 = ldpv.Period8, Period9 = ldpv.Period9, Period10 = ldpv.Period10, Period11 = ldpv.Period11, Period12 = ldpv.Period12, UKPRN = ukPrn, FundLine = ld.LearningDeliveryValue?.FundLine }); } } } return(result); }
public AdultFundingClaimModel BuildAdultFundingClaimModel( ILogger logger, IReportServiceContext reportServiceContext, FM35Global fm35Global, List <EasSubmissionValues> easSubmissionValues, ALBGlobal albGlobal, string providerName, ILRSourceFileInfo ilrSourceFileInfo, IDateTimeProvider dateTimeProvider, IIntUtilitiesService intUtilitiesService, IMessage message, IVersionInfo versionInfo, string orgData, string largeEmployersData, string postcodeData, string larsData) { var adultFundingClaimModel = new AdultFundingClaimModel(); try { var ilrfileName = reportServiceContext.OriginalFilename ?? reportServiceContext.Filename; // FM35 decimal otherLearningProgramFunding6MonthsFm35 = 0; decimal otherLearningProgramFunding12MonthsFm35 = 0; decimal otherLearningSupport6MonthsFm35 = 0; decimal otherLearningSupport12MonthsFm35 = 0; decimal traineeShips1924ProgrammeFunding6MonthsFm35 = 0; decimal traineeShips1924ProgrammeFunding12MonthsFm35 = 0; decimal traineeShips1924LearningSupport6MonthsFm35 = 0; decimal traineeShips1924LearningSupport12MonthsFm35 = 0; // EAS decimal otherLearningProgramFunding6MonthsEas = 0; decimal otherLearningProgramFunding12MonthsEas = 0; decimal otherLearningSupport6MonthsEas = 0; decimal otherLearningSupport12MonthsEas = 0; decimal traineeShips1924ProgrammeFunding6MonthsEas = 0; decimal traineeShips1924ProgrammeFunding12MonthsEas = 0; decimal traineeShips1924LearningSupport6MonthsEas = 0; decimal traineeShips1924LearningSupport12MonthsEas = 0; decimal traineeShips1924LearnerSupport6MonthsEas = 0; decimal traineeShips1924LearnerSupport12MonthsEas = 0; decimal loansAreasCosts6MonthsEas = 0; decimal loansAreasCosts12MonthsEas = 0; decimal loansExcessSupport6MonthsEas = 0; decimal loansExcessSupport12MonthsEas = 0; // ALB decimal loansBursaryFunding6Months = 0; decimal loansBursaryFunding12Months = 0; decimal loansAreaCosts6Months = 0; decimal loansAreaCosts12Months = 0; var ukPrn = reportServiceContext.Ukprn; // FM35 var fm35LearningDeliveryPeriodisedValues = GetFM35LearningDeliveryPeriodisedValues(fm35Global, ukPrn); otherLearningProgramFunding6MonthsFm35 = Fm35DeliveryValues6Months(fm35LearningDeliveryPeriodisedValues, new[] { "OnProgPayment", "BalancePayment", "AchievePayment", "EmpOutcomePay" }, new[] { "AEB - Other Learning", "AEB - Other Learning (non-procured)" }); otherLearningProgramFunding12MonthsFm35 = Fm35DeliveryValues12Months(fm35LearningDeliveryPeriodisedValues, new[] { "OnProgPayment", "BalancePayment", "AchievePayment", "EmpOutcomePay" }, new[] { "AEB - Other Learning", "AEB - Other Learning (non-procured)" }); otherLearningSupport6MonthsFm35 = Fm35DeliveryValues6Months(fm35LearningDeliveryPeriodisedValues, new[] { "LearnSuppFundCash" }, new[] { "AEB - Other Learning", "AEB - Other Learning (non-procured)" }); otherLearningSupport12MonthsFm35 = Fm35DeliveryValues12Months(fm35LearningDeliveryPeriodisedValues, new[] { "LearnSuppFundCash" }, new[] { "AEB - Other Learning", "AEB - Other Learning (non-procured)" }); traineeShips1924ProgrammeFunding6MonthsFm35 = Fm35DeliveryValues6Months(fm35LearningDeliveryPeriodisedValues, new[] { "OnProgPayment", "BalancePayment", "AchievePayment", "EmpOutcomePay" }, new[] { "19-24 Traineeship’", "19-24 Traineeship (non-procured)" }); traineeShips1924ProgrammeFunding12MonthsFm35 = Fm35DeliveryValues12Months(fm35LearningDeliveryPeriodisedValues, new[] { "OnProgPayment", "BalancePayment", "AchievePayment", "EmpOutcomePay" }, new[] { "19-24 Traineeship’", "19-24 Traineeship (non-procured)" }); traineeShips1924LearningSupport6MonthsFm35 = Fm35DeliveryValues6Months(fm35LearningDeliveryPeriodisedValues, new[] { "LearnSuppFundCash" }, new[] { "19-24 Traineeship’", "19-24 Traineeship (non-procured)" }); traineeShips1924LearningSupport12MonthsFm35 = Fm35DeliveryValues12Months(fm35LearningDeliveryPeriodisedValues, new[] { "LearnSuppFundCash" }, new[] { "19-24 Traineeship’", "19-24 Traineeship (non-procured)" }); // ALB var albLearningDeliveryPeriodisedValues = GetAlbLearningDeliveryPeriodisedValues(albGlobal, ukPrn); loansBursaryFunding6Months = AlbDeliveryValues6Months(albLearningDeliveryPeriodisedValues, new[] { "ALBSupportPayment" }, new[] { "Advanced Learner Loans Bursary" }); loansBursaryFunding12Months = AlbDeliveryValues12Months(albLearningDeliveryPeriodisedValues, new[] { "ALBSupportPayment" }, new[] { "Advanced Learner Loans Bursary" }); loansAreaCosts6Months = AlbDeliveryValues6Months(albLearningDeliveryPeriodisedValues, new[] { "AreaUpliftBalPayment", "AreaUpliftOnProgPayment" }, new[] { "Advanced Learner Loans Bursary" }); loansAreaCosts12Months = AlbDeliveryValues12Months(albLearningDeliveryPeriodisedValues, new[] { "AreaUpliftBalPayment", "AreaUpliftOnProgPayment" }, new[] { "Advanced Learner Loans Bursary" }); // EAS otherLearningProgramFunding6MonthsEas = easSubmissionValues.Where(x => new[] { "Authorised Claims: AEB-Other Learning", "Princes Trust: AEB-Other Learning" }.Contains(x.PaymentTypeName) && First6MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); otherLearningProgramFunding12MonthsEas = easSubmissionValues.Where(x => new[] { "Authorised Claims: AEB-Other Learning", "Princes Trust: AEB-Other Learning" }.Contains(x.PaymentTypeName) && First12MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); otherLearningSupport6MonthsEas = easSubmissionValues.Where(x => new[] { "Excess Learning Support: AEB-Other Learning" }.Contains(x.PaymentTypeName) && First6MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); otherLearningSupport12MonthsEas = easSubmissionValues.Where(x => new[] { "Excess Learning Support: AEB-Other Learning" }.Contains(x.PaymentTypeName) && First12MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); traineeShips1924ProgrammeFunding6MonthsEas = easSubmissionValues.Where(x => new[] { "Authorised Claims: 19-24 Traineeships" }.Contains(x.PaymentTypeName) && First6MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); traineeShips1924ProgrammeFunding12MonthsEas = easSubmissionValues.Where(x => new[] { "Authorised Claims: 19-24 Traineeships" }.Contains(x.PaymentTypeName) && First12MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); traineeShips1924LearningSupport6MonthsEas = easSubmissionValues.Where(x => new[] { "Excess Learning Support: 19-24 Traineeships" }.Contains(x.PaymentTypeName) && First6MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); traineeShips1924LearningSupport12MonthsEas = easSubmissionValues.Where(x => new[] { "Excess Learning Support: 19-24 Traineeships" }.Contains(x.PaymentTypeName) && First12MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); traineeShips1924LearnerSupport6MonthsEas = easSubmissionValues.Where(x => new[] { "Learner Support: 19-24 Traineeships" }.Contains(x.PaymentTypeName) && First6MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); traineeShips1924LearnerSupport12MonthsEas = easSubmissionValues.Where(x => new[] { "Learner Support: 19-24 Traineeships" }.Contains(x.PaymentTypeName) && First12MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); loansAreasCosts6MonthsEas = easSubmissionValues.Where(x => new[] { "Authorised Claims: Advanced Learner Loans Bursary" }.Contains(x.PaymentTypeName) && First6MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); loansAreasCosts12MonthsEas = easSubmissionValues.Where(x => new[] { "Authorised Claims: Advanced Learner Loans Bursary" }.Contains(x.PaymentTypeName) && First12MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); loansExcessSupport6MonthsEas = easSubmissionValues.Where(x => new[] { "Excess Support: Advanced Learner Loans Bursary" }.Contains(x.PaymentTypeName) && First6MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); loansExcessSupport12MonthsEas = easSubmissionValues.Where(x => new[] { "Excess Support: Advanced Learner Loans Bursary" }.Contains(x.PaymentTypeName) && First12MonthsArray.Contains(x.CollectionPeriod)).Sum(y => y.PaymentValue); adultFundingClaimModel.OtherLearningProgrammeFunding6Months = otherLearningProgramFunding6MonthsFm35 + otherLearningProgramFunding6MonthsEas; adultFundingClaimModel.OtherLearningProgrammeFunding12Months = otherLearningProgramFunding12MonthsFm35 + otherLearningProgramFunding12MonthsEas; adultFundingClaimModel.OtherLearningLearningSupport6Months = otherLearningSupport6MonthsFm35 + otherLearningSupport6MonthsEas; adultFundingClaimModel.OtherLearningLearningSupport12Months = otherLearningSupport12MonthsFm35 + otherLearningSupport12MonthsEas; adultFundingClaimModel.Traineeships1924ProgrammeFunding6Months = traineeShips1924ProgrammeFunding6MonthsFm35 + traineeShips1924ProgrammeFunding6MonthsEas; adultFundingClaimModel.Traineeships1924ProgrammeFunding12Months = traineeShips1924ProgrammeFunding12MonthsFm35 + traineeShips1924ProgrammeFunding12MonthsEas; adultFundingClaimModel.Traineeships1924LearningSupport6Months = traineeShips1924LearningSupport6MonthsFm35 + traineeShips1924LearningSupport6MonthsEas; adultFundingClaimModel.Traineeships1924LearningSupport12Months = traineeShips1924LearningSupport12MonthsFm35 + traineeShips1924LearningSupport12MonthsEas; adultFundingClaimModel.Traineeships1924LearnerSupport6Months = traineeShips1924LearnerSupport6MonthsEas; adultFundingClaimModel.Traineeships1924LearnerSupport12Months = traineeShips1924LearnerSupport12MonthsEas; adultFundingClaimModel.LoansBursaryFunding6Months = loansBursaryFunding6Months; adultFundingClaimModel.LoansBursaryFunding12Months = loansBursaryFunding12Months; adultFundingClaimModel.LoansAreaCosts6Months = loansAreaCosts6Months + loansAreasCosts6MonthsEas; adultFundingClaimModel.LoansAreaCosts12Months = loansAreaCosts12Months + loansAreasCosts12MonthsEas; adultFundingClaimModel.LoansExcessSupport6Months = loansExcessSupport6MonthsEas; adultFundingClaimModel.LoansExcessSupport12Months = loansExcessSupport12MonthsEas; adultFundingClaimModel.ProviderName = providerName ?? "Unknown"; adultFundingClaimModel.Ukprn = ukPrn; adultFundingClaimModel.ReportGeneratedAt = "Report generated at: " + dateTimeProvider.GetNowUtc().ToString("hh:mm:ss tt") + " on " + dateTimeProvider.GetNowUtc().ToString("dd/MM/yyyy"); if (message == null) // NON - ILR Submission. { if (ilrSourceFileInfo.Filename == null) { adultFundingClaimModel.IlrFile = "NA"; adultFundingClaimModel.FilePreparationDate = "NA"; } else { adultFundingClaimModel.IlrFile = ilrSourceFileInfo.Filename; adultFundingClaimModel.FilePreparationDate = ilrSourceFileInfo.FilePreparationDate.GetValueOrDefault().ToString("dd/MM/yyyy"); } } else { adultFundingClaimModel.IlrFile = ilrfileName; adultFundingClaimModel.FilePreparationDate = message.HeaderEntity.CollectionDetailsEntity.FilePreparationDate.ToString("dd/MM/yyyy"); } adultFundingClaimModel.ApplicationVersion = versionInfo.ServiceReleaseVersion; adultFundingClaimModel.ComponentSetVersion = "NA"; adultFundingClaimModel.LargeEmployerData = largeEmployersData; adultFundingClaimModel.OrganisationData = orgData; adultFundingClaimModel.PostcodeData = postcodeData; adultFundingClaimModel.LarsData = larsData; } catch (Exception ex) { logger.LogError($"Failed building Adult funding claim report, ex: {ex}"); throw; } return(adultFundingClaimModel); }
public void BuildTest() { var dependentDataMock = new Mock <IReportServiceDependentData>(); var referenceDataRoot = new ReferenceDataRoot() { Organisations = new List <Organisation>() { new Organisation() { UKPRN = 987654321, Name = "Provider XYZ", OrganisationCoFRemovals = new List <OrganisationCoFRemoval>() { new OrganisationCoFRemoval() { EffectiveFrom = new DateTime(2019, 01, 01), CoFRemoval = (decimal)4500.12 } }, } }, MetaDatas = new MetaData() { ReferenceDataVersions = new ReferenceDataVersion() { OrganisationsVersion = new OrganisationsVersion { Version = "1.1.1.1" }, Employers = new EmployersVersion { Version = "2.2.2.2" }, LarsVersion = new LarsVersion { Version = "3.3.3.3" }, PostcodesVersion = new PostcodesVersion { Version = "4.4.4.4" }, CampusIdentifierVersion = new CampusIdentifierVersion() { Version = "5.5.5.5" }, EasFileDetails = new EasFileDetails { UploadDateTime = new DateTime(2020, 1, 1, 1, 1, 1) } } } }; var easFundingLines = BuildEasFundingLines(); var fm35Learner = new FM35Learner { LearnRefNumber = "Learner1", LearningDeliveries = BuildFm35LearningDeliveries() }; var fm35Global = new FM35Global() { Learners = new List <FM35Learner>() { fm35Learner } }; var albLearner = new ALBLearner() { LearnRefNumber = "Learner1", LearningDeliveries = BuildAlbLearningDeliveries() }; var albGlobal = new ALBGlobal() { Learners = new List <ALBLearner>() { albLearner } }; dependentDataMock.Setup(d => d.Get <ReferenceDataRoot>()).Returns(referenceDataRoot); dependentDataMock.Setup(d => d.Get <FM35Global>()).Returns(fm35Global); dependentDataMock.Setup(d => d.Get <ALBGlobal>()).Returns(albGlobal); dependentDataMock.Setup(d => d.Get <List <EasFundingLine> >()).Returns(easFundingLines); var submissionDateTime = new DateTime(2020, 1, 1, 1, 1, 1); var ukDateTime = new DateTime(2020, 1, 1, 1, 1, 1); var dateTimeProvider = new Mock <IDateTimeProvider>(); var reportServiceContextMock = new Mock <IReportServiceContext>(); reportServiceContextMock.SetupGet(c => c.Ukprn).Returns(987654321); reportServiceContextMock.SetupGet(c => c.SubmissionDateTimeUtc).Returns(submissionDateTime); reportServiceContextMock.SetupGet(c => c.ServiceReleaseVersion).Returns("11.22.3300.4321"); reportServiceContextMock.SetupGet(c => c.IlrReportingFilename).Returns("ILR-12345678-2021-20201005-151322-01.xml"); reportServiceContextMock.SetupGet(c => c.EasReportingFilename).Returns("EAS-12345678-2021-20201005-151322-01.csv"); dateTimeProvider.Setup(p => p.GetNowUtc()).Returns(submissionDateTime); dateTimeProvider.SetupSequence(p => p.ConvertUtcToUk(It.IsAny <DateTime>())) .Returns(ukDateTime) .Returns(new DateTime(2020, 1, 1, 1, 1, 1)); var result = NewBuilder(dateTimeProvider.Object).Build(reportServiceContextMock.Object, dependentDataMock.Object); result.ProviderName.Should().Be("Provider XYZ"); result.Ukprn.Should().Be("987654321"); result.IlrFile.Should().Be("ILR-12345678-2021-20201005-151322-01.xml"); result.EasFile.Should().Be("EAS-12345678-2021-20201005-151322-01.csv"); result.Year.Should().Be("2020/21"); result.ReportGeneratedAt.Should().Be("Report generated at: 01:01:01 on 01/01/2020"); result.ApplicationVersion.Should().Be("11.22.3300.4321"); result.LarsData.Should().Be("3.3.3.3"); result.OrganisationData.Should().Be("1.1.1.1"); result.PostcodeData.Should().Be("4.4.4.4"); result.CampusIdData.Should().Be("5.5.5.5"); result.AEBProgrammeFunding.MidYearClaims.Should().Be(135.324m); result.AEBProgrammeFunding.YearEndClaims.Should().Be(350.384m); result.AEBProgrammeFunding.FinalClaims.Should().Be(489.3132m); result.AEBLearningSupport.MidYearClaims.Should().Be(44.331m); result.AEBLearningSupport.YearEndClaims.Should().Be(115.096m); result.AEBLearningSupport.FinalClaims.Should().Be(161.3283m); result.AEBProgrammeFunding1924.MidYearClaims.Should().Be(114.324m); result.AEBProgrammeFunding1924.YearEndClaims.Should().Be(295.384m); result.AEBProgrammeFunding1924.FinalClaims.Should().Be(411.3132m); result.AEBLearningSupport1924.MidYearClaims.Should().Be(44.331m); result.AEBLearningSupport1924.YearEndClaims.Should().Be(115.096m); result.AEBLearningSupport1924.FinalClaims.Should().Be(161.3283m); result.ALBBursaryFunding.MidYearClaims.Should().Be(23.331m); result.ALBBursaryFunding.YearEndClaims.Should().Be(60.096m); result.ALBBursaryFunding.FinalClaims.Should().Be(83.3283m); result.ALBAreaCosts.MidYearClaims.Should().Be(67.662m); result.ALBAreaCosts.YearEndClaims.Should().Be(175.192m); result.ALBAreaCosts.FinalClaims.Should().Be(244.6566m); result.ALBExcessSupport.MidYearClaims.Should().Be(21m); result.ALBExcessSupport.YearEndClaims.Should().Be(55m); result.ALBExcessSupport.FinalClaims.Should().Be(78m); }
public Dictionary <string, Dictionary <string, decimal?[][]> > BuildFm99Dictionary(ALBGlobal fm99Global) { return(fm99Global .Learners? .SelectMany(l => l.LearningDeliveries) .GroupBy(ld => ld.LearningDeliveryValue.FundLine, StringComparer.OrdinalIgnoreCase) .ToDictionary(k => k.Key, v => v.SelectMany(ld => ld.LearningDeliveryPeriodisedValues) .GroupBy(ldpv => ldpv.AttributeName, StringComparer.OrdinalIgnoreCase) .ToDictionary(k => k.Key, value => value.Select(pvGroup => new decimal?[] { pvGroup.Period1, pvGroup.Period2, pvGroup.Period3, pvGroup.Period4, pvGroup.Period5, pvGroup.Period6, pvGroup.Period7, pvGroup.Period8, pvGroup.Period9, pvGroup.Period10, pvGroup.Period11, pvGroup.Period12, }).ToArray(), StringComparer.OrdinalIgnoreCase), StringComparer.OrdinalIgnoreCase) ?? new Dictionary <string, Dictionary <string, decimal?[][]> >()); }