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);
        }
        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);
        }
示例#3
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);
        }
        public void Build_FiftyThousandLearners()
        {
            var reportServiceContext = Mock.Of <IReportServiceContext>();
            var dependentDataMock    = new Mock <IReportServiceDependentData>();

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

            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()
                        {
                            LearnAimRef          = "learnAimRef" + l,
                            AimSeqNumber         = 1,
                            LearningDeliveryFAMs = new List <ILearningDeliveryFAM>()
                            {
                                new TestLearningDeliveryFAM()
                                {
                                    LearnDelFAMType = "SOF",
                                    LearnDelFAMCode = "110",
                                }
                            }
                        }
                    }
                }).ToList()
            };

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

            var referenceDataRoot = new ReferenceDataRoot()
            {
                LARSLearningDeliveries = Enumerable.Range(0, learnerCount)
                                         .Select(ld =>
                                                 new LARSLearningDelivery()
                {
                    LearnAimRef = "learnAimRef" + ld,
                    LARSLearningDeliveryCategories = new HashSet <LARSLearningDeliveryCategory>
                    {
                        new LARSLearningDeliveryCategory
                        {
                            CategoryRef = 123
                        }
                    },
                }).ToList(),
                DevolvedPostocdes = new DevolvedPostcodes
                {
                    McaGlaSofLookups = new List <McaGlaSofLookup>
                    {
                        mcaGlaSofLookup
                    }
                },
                Organisations = new List <Organisation>()
                {
                    new Organisation()
                    {
                        UKPRN = 12345678, Name = "Partner Provider"
                    }
                }
            };

            var fm35Global = new FM35Global()
            {
                Learners = Enumerable.Range(0, learnerCount)
                           .Select(
                    l =>
                    new FM35Learner()
                {
                    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 <FM35Global>()).Returns(fm35Global);

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

            result.Should().HaveCount(learnerCount);
        }
        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");
        }
示例#6
0
        public void Build_SingleRow()
        {
            var reportServiceContext = Mock.Of <IReportServiceContext>();
            var dependentDataMock    = new Mock <IReportServiceDependentData>();

            var actLearningDeliveryFam = new Mock <ILearningDeliveryFAM>();

            actLearningDeliveryFam.SetupGet(fam => fam.LearnDelFAMType).Returns("ACT");
            actLearningDeliveryFam.SetupGet(fam => fam.LearnDelFAMCode).Returns("1");

            var albLearningDeliveryFam = new Mock <ILearningDeliveryFAM>();

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

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

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

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

            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",
                LearnAimRefTitle       = "A",
                NotionalNVQLevel       = "B",
                SectorSubjectAreaTier2 = 3
            };

            var larsStandard = new LARSStandard()
            {
                StandardCode     = 1,
                NotionalEndLevel = "NotionalEndLevel"
            };

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

            var priceEpisodeValues = new PriceEpisodeValues()
            {
                EpisodeStartDate         = new DateTime(2020, 08, 08),
                PriceEpisodeAimSeqNumber = 1
            };

            var priceEpisodes = new PriceEpisode()
            {
                PriceEpisodeValues           = priceEpisodeValues,
                PriceEpisodePeriodisedValues = new List <PriceEpisodePeriodisedValues>()
                {
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeOnProgPaymentAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm3PriceEpisodeBalancePaymentAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeCompletionPaymentAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeLSFCashAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeFirstDisadvantagePaymentAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeSecondDisadvantagePaymentAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeFirstEmp1618PayAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeSecondEmp1618PayAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeFirstProv1618PayAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeSecondProv1618PayAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeLearnerAdditionalPaymentAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeApplic1618FrameworkUpliftOnProgPaymentAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeApplic1618FrameworkUpliftBalancingAttributeName),
                    BuildPriceEpisodePeriodisedValuesForAttribute(AttributeConstants.Fm36PriceEpisodeApplic1618FrameworkUpliftCompletionPaymentAttributeName),
                }
            };

            var learningDeliveryValues = new LearningDeliveryValues();
            var appsLearningDelivery   = new LearningDelivery()
            {
                AimSeqNumber                     = 1,
                LearningDeliveryValues           = learningDeliveryValues,
                LearningDeliveryPeriodisedValues = new List <LearningDeliveryPeriodisedValues>()
                {
                    BuildLearningDeliveryPeriodisedValuesForAttribute(AttributeConstants.Fm36MathEngOnProgPayment),
                    BuildLearningDeliveryPeriodisedValuesForAttribute(AttributeConstants.Fm36MathEngBalPayment),
                    BuildLearningDeliveryPeriodisedValuesForAttribute(AttributeConstants.Fm36LearnSuppFundCash)
                }
            };

            var fm36Global = new FM36Global()
            {
                Learners = new List <FM36Learner>()
                {
                    new FM36Learner()
                    {
                        LearnRefNumber     = "LearnRefNumber",
                        LearningDeliveries = new List <LearningDelivery>()
                        {
                            appsLearningDelivery,
                        },
                        PriceEpisodes = new List <PriceEpisode>()
                        {
                            priceEpisodes
                        }
                    }
                }
            };

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

            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.Fm36LearningDelivery.Should().Be(learningDeliveryValues);

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


            row.PeriodisedValues.August.AdditionalPaymentsForApprentices.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.AimCompletionEarnings.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.BalancingPaymentEarnings.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.EnglishMathsBalancingPaymentEarnings.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.EnglishMathsOnProgrammeEarnings.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.FrameworkUpliftBalancingPayment1618.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.FrameworkUpliftCompletionPayment1618.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.FrameworkUpliftOnProgrammePayment1618.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.LearningSupportEarnings.Should().Be((decimal)1.111);
            row.PeriodisedValues.August.OnProgrammeEarnings.Should().Be((decimal)1.111);

            row.PeriodisedValues.August.DisadvantageEarnings.Should().Be((decimal)2.222);
            row.PeriodisedValues.May.DisadvantageEarnings.Should().Be((decimal)20.2020);

            row.PeriodisedValues.August.AdditionalPaymentForEmployers1618.Should().Be((decimal)2.222);
            row.PeriodisedValues.May.AdditionalPaymentForEmployers1618.Should().Be((decimal)20.2020);

            row.PeriodisedValues.August.AdditionalPaymentForProviders1618.Should().Be((decimal)2.222);
            row.PeriodisedValues.May.AdditionalPaymentForProviders1618.Should().Be((decimal)20.2020);

            //var csvService = new CsvService(new FileServiceStub());
            //csvService.WriteAsync<AppsIndicativeEarningsReportModel, AppsIndicativeEarningsReportClassMap>(result, "AppsIndicativeEarningsReport.csv", "", CancellationToken.None).ConfigureAwait(false);
        }