public void BuildLearner() { var learner = new FM81LearnerDto() { LearnRefNumber = "ABC", DateOfBirth = new DateTime(2000, 8, 1), }; var dataEntity = NewService().BuildLearnerDataEntity(learner); dataEntity.EntityName.Should().Be("Learner"); dataEntity.Attributes.Should().HaveCount(2); dataEntity.Attributes["LearnRefNumber"].Value.Should().Be(learner.LearnRefNumber); dataEntity.Attributes["DateOfBirth"].Value.Should().Be(learner.DateOfBirth); dataEntity.Children.Should().BeEmpty(); }
public void ProvideDtos_DtoAsExpected() { IMessage message = new Message { LearningProvider = new MessageLearningProvider { UKPRN = 12345678 }, Learner = new MessageLearner[] { new MessageLearner { LearnRefNumber = "Learner_1", DateOfBirthSpecified = true, DateOfBirth = new DateTime(1990, 8, 1), LearnerEmploymentStatus = new MessageLearnerLearnerEmploymentStatus[] { new MessageLearnerLearnerEmploymentStatus { EmpIdSpecified = true, EmpId = 1, DateEmpStatApp = new DateTime(2020, 8, 1), EmpStat = 2, EmploymentStatusMonitoring = new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring[] { new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring { ESMType = "SEM", ESMCode = 1 }, new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring { ESMType = "HNS", ESMCode = 1 } } } }, LearningDelivery = new MessageLearnerLearningDelivery[] { new MessageLearnerLearningDelivery { AchDateSpecified = true, AchDate = new DateTime(2019, 8, 1), AimType = 1, LearnAimRef = "AimRef", FundModel = 81, AimSeqNumber = 1, CompStatus = 2, DelLocPostCode = "DelLocPostCode", LearnActEndDateSpecified = true, LearnActEndDate = new DateTime(2019, 8, 1), LearnPlanEndDate = new DateTime(2019, 8, 1), LearnStartDate = new DateTime(2019, 8, 1), OrigLearnStartDateSpecified = true, OrigLearnStartDate = new DateTime(2019, 8, 1), OtherFundAdjSpecified = true, OtherFundAdj = 3, OutcomeSpecified = true, Outcome = 4, PriorLearnFundAdjSpecified = true, PriorLearnFundAdj = 5, ProgTypeSpecified = true, ProgType = 25, StdCodeSpecified = true, StdCode = 1, WithdrawReasonSpecified = true, WithdrawReason = 1, LearningDeliveryFAM = new MessageLearnerLearningDeliveryLearningDeliveryFAM[] { new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "EEF" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "FFI" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "SOF" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "SPP" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "RES" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "LDM" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "2", LearnDelFAMType = "LDM" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "3", LearnDelFAMType = "LDM" } }, AppFinRecord = new MessageLearnerLearningDeliveryAppFinRecord[] { new MessageLearnerLearningDeliveryAppFinRecord { AFinAmount = 1, AFinCode = 1, AFinDate = new DateTime(2019, 8, 1), AFinType = "PMR" }, new MessageLearnerLearningDeliveryAppFinRecord { AFinAmount = 1, AFinCode = 1, AFinDate = new DateTime(2019, 8, 1), AFinType = "TNP" } } } } } } }; var expectedDto = new FM81LearnerDto { LearnRefNumber = "Learner_1", DateOfBirth = new DateTime(1990, 8, 1), LearnerEmploymentStatuses = new List <LearnerEmploymentStatus> { new LearnerEmploymentStatus { EmpId = 1, DateEmpStatApp = new DateTime(2020, 8, 1), EmpStat = 2, SEM = 1 } }, LearningDeliveries = new List <LearningDelivery> { new LearningDelivery { AchDate = new DateTime(2019, 8, 1), AimType = 1, LearnAimRef = "AimRef", FundModel = 81, AimSeqNumber = 1, CompStatus = 2, LearnActEndDate = new DateTime(2019, 8, 1), LearnPlanEndDate = new DateTime(2019, 8, 1), LearnStartDate = new DateTime(2019, 8, 1), OrigLearnStartDate = new DateTime(2019, 8, 1), OtherFundAdj = 3, Outcome = 4, PriorLearnFundAdj = 5, ProgType = 25, StdCode = 1, WithdrawReason = 1, LearningDeliveryFAMs = new List <LearningDeliveryFAM> { new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "EEF" }, new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "FFI" }, new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "SOF" }, new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "SPP" }, new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "RES" }, new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "LDM" }, new LearningDeliveryFAM { LearnDelFAMCode = "2", LearnDelFAMType = "LDM" }, new LearningDeliveryFAM { LearnDelFAMCode = "3", LearnDelFAMType = "LDM" } }, AppFinRecords = new List <AppFinRecord> { new AppFinRecord { AFinAmount = 1, AFinCode = 1, AFinDate = new DateTime(2019, 8, 1), AFinType = "PMR" }, new AppFinRecord { AFinAmount = 1, AFinCode = 1, AFinDate = new DateTime(2019, 8, 1), AFinType = "TNP" } } } } }; NewService().ProvideDtos(FundModelFilter, message).First().Should().BeEquivalentTo(expectedDto); }
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())); }