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 BuildLearner() { var learner = new ALBLearnerDto() { LearnRefNumber = "ABC", }; var dataEntity = NewService().BuildLearnerDataEntity(learner); dataEntity.EntityName.Should().Be("Learner"); dataEntity.Attributes.Should().HaveCount(1); dataEntity.Attributes["LearnRefNumber"].Value.Should().Be(learner.LearnRefNumber); 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", LearningDelivery = new MessageLearnerLearningDelivery[] { new MessageLearnerLearningDelivery { LearnAimRef = "AimRef", FundModel = 99, AimSeqNumber = 1, CompStatus = 2, DelLocPostCode = "DelLocPostCode", LearnActEndDateSpecified = true, LearnActEndDate = new DateTime(2018, 8, 1), LearnPlanEndDate = new DateTime(2018, 8, 1), LearnStartDate = new DateTime(2018, 8, 1), OrigLearnStartDateSpecified = true, OrigLearnStartDate = new DateTime(2018, 8, 1), OtherFundAdjSpecified = true, OtherFundAdj = 3, OutcomeSpecified = true, Outcome = 4, PriorLearnFundAdjSpecified = true, PriorLearnFundAdj = 5, LearningDeliveryFAM = new MessageLearnerLearningDeliveryLearningDeliveryFAM[] { new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "ADL" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "RES" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "LDM" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "2", LearnDelFAMType = "LDM" }, new MessageLearnerLearningDeliveryLearningDeliveryFAM { LearnDelFAMCode = "3", LearnDelFAMType = "LDM" } } } } } } }; var expectedDto = new ALBLearnerDto { LearnRefNumber = "Learner_1", LearningDeliveries = new List <LearningDelivery> { new LearningDelivery { LearnAimRef = "AimRef", FundModel = 99, AimSeqNumber = 1, CompStatus = 2, DelLocPostCode = "DelLocPostCode", LearnActEndDate = new DateTime(2018, 8, 1), LearnPlanEndDate = new DateTime(2018, 8, 1), LearnStartDate = new DateTime(2018, 8, 1), OrigLearnStartDate = new DateTime(2018, 8, 1), OtherFundAdj = 3, Outcome = 4, PriorLearnFundAdj = 5, LearningDeliveryFAMs = new List <LearningDeliveryFAM> { new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "ADL" }, new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "RES" }, new LearningDeliveryFAM { LearnDelFAMCode = "1", LearnDelFAMType = "LDM" }, new LearningDeliveryFAM { LearnDelFAMCode = "2", LearnDelFAMType = "LDM" }, new LearningDeliveryFAM { LearnDelFAMCode = "3", LearnDelFAMType = "LDM" } } } } }; NewService().ProvideDtos(FundModelFilter, message).First().Should().BeEquivalentTo(expectedDto); }