public void EfaPostcodeDisadvantagesToEntity() { var efaPostcodeDisadvantage = new EfaPostcodeDisadvantage { Uplift = 1.0m, EffectiveFrom = new DateTime(2018, 8, 1), EffectiveTo = new DateTime(2018, 8, 31) }; var efaDisdvantage = new EfaDisadvantage { Uplift = 1.0m, EffectiveFrom = new DateTime(2018, 8, 1), EffectiveTo = new DateTime(2018, 8, 31) }; NewMapper().EfaPostcodeDisadvantagesToEntity(efaPostcodeDisadvantage).Should().BeEquivalentTo(efaDisdvantage); }
public void LatestEfaDisadvantage() { var postcode = "postcode"; var uplift = 1.1m; var efaDisadvantageOne = new EfaDisadvantage { Postcode = "CV1 2WT", Uplift = 1.0m, EffectiveFrom = new DateTime(2000, 01, 01), EffectiveTo = new DateTime(2015, 07, 31), }; var efaDisadvatageTwo = new EfaDisadvantage { Postcode = "CV1 2WT", Uplift = uplift, EffectiveFrom = new DateTime(2015, 08, 01), EffectiveTo = new DateTime(2019, 07, 31), }; var efaDisadvantages = new List <EfaDisadvantage>() { efaDisadvantageOne, efaDisadvatageTwo }; var referenceDataCacheMock = new Mock <IExternalDataCache>(); referenceDataCacheMock.SetupGet(rdc => rdc.PostcodeRoots) .Returns(new Dictionary <string, PostcodeRoot>() { { postcode, new PostcodeRoot() { EfaDisadvantages = efaDisadvantages } } }); NewService(referenceDataCacheMock.Object).LatestEFADisadvantagesUpliftForPostcode(postcode).Should().Be(efaDisadvatageTwo.Uplift); }
public void BuildLearner() { var learner = new TestLearner() { DateOfBirthNullable = new DateTime(1990, 12, 25), EngGrade = "A", LearnRefNumber = "ABC", MathGrade = "B", PlanEEPHoursNullable = 2, PlanLearnHoursNullable = 3, Postcode = "postcode", ULN = 123456, LearnerFAMs = new List <TestLearnerFAM>() { new TestLearnerFAM() { LearnFAMType = "ECF", LearnFAMCode = 1 }, new TestLearnerFAM() { LearnFAMType = "EDF", LearnFAMCode = 2 }, new TestLearnerFAM() { LearnFAMType = "EDF", LearnFAMCode = 3 }, new TestLearnerFAM() { LearnFAMType = "EHC", LearnFAMCode = 4 }, new TestLearnerFAM() { LearnFAMType = "HNS", LearnFAMCode = 5 }, new TestLearnerFAM() { LearnFAMType = "MCF", LearnFAMCode = 6 }, } }; var uplift = 1.1m; var efaDisadvantageOne = new EfaDisadvantage { Postcode = "CV1 2WT", Uplift = 1.0m, EffectiveFrom = new DateTime(2000, 01, 01), EffectiveTo = new DateTime(2015, 07, 31), }; var efaDisadvatageTwo = new EfaDisadvantage { Postcode = "CV1 2WT", Uplift = uplift, EffectiveFrom = new DateTime(2015, 08, 01), EffectiveTo = new DateTime(2019, 07, 31), }; var efaDisadvantages = new List <EfaDisadvantage>() { efaDisadvantageOne, efaDisadvatageTwo }; var fileDataServiceMock = new Mock <IFileDataService>(); fileDataServiceMock.Setup(fds => fds.DPOutcomesForLearnRefNumber(learner.LearnRefNumber)).Returns(new List <DPOutcome>()); var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>(); postcodesReferenceDataServiceMock.Setup(p => p.LatestEFADisadvantagesUpliftForPostcode(learner.Postcode)).Returns(efaDisadvatageTwo.Uplift); var dataEntity = NewService(postcodesReferenceDataService: postcodesReferenceDataServiceMock.Object, fileDataService: fileDataServiceMock.Object).BuildLearnerDataEntity(learner); dataEntity.EntityName.Should().Be("Learner"); dataEntity.Attributes.Should().HaveCount(14); dataEntity.Attributes["DateOfBirth"].Value.Should().Be(learner.DateOfBirthNullable); dataEntity.Attributes["EngGrade"].Value.Should().Be(learner.EngGrade); dataEntity.Attributes["LearnRefNumber"].Value.Should().Be(learner.LearnRefNumber); dataEntity.Attributes["LrnFAM_ECF"].Value.Should().Be(1); dataEntity.Attributes["LrnFAM_EDF1"].Value.Should().Be(2); dataEntity.Attributes["LrnFAM_EDF2"].Value.Should().Be(3); dataEntity.Attributes["LrnFAM_EHC"].Value.Should().Be(4); dataEntity.Attributes["LrnFAM_HNS"].Value.Should().Be(5); dataEntity.Attributes["LrnFAM_MCF"].Value.Should().Be(6); dataEntity.Attributes["MathGrade"].Value.Should().Be(learner.MathGrade); dataEntity.Attributes["PlanEEPHours"].Value.Should().Be(learner.PlanEEPHoursNullable); dataEntity.Attributes["PostcodeDisadvantageUplift"].Value.Should().Be(uplift); dataEntity.Attributes["ULN"].Value.Should().Be(learner.ULN); dataEntity.Children.Should().BeEmpty(); }
public void BuildLearner() { var learner = new FM25LearnerDto() { DateOfBirth = new DateTime(1990, 12, 25), EngGrade = "A", LearnRefNumber = "ABC", MathGrade = "B", PlanEEPHours = 2, PlanLearnHours = 3, Postcode = "postcode", ULN = 123456, LrnFAM_ECF = 1, LrnFAM_EDF1 = 2, LrnFAM_EDF2 = 3, LrnFAM_EHC = 4, LrnFAM_HNS = 5, LrnFAM_MCF = 6, }; var uplift = 1.1m; var efaDisadvantageOne = new EfaDisadvantage { Postcode = "CV1 2WT", Uplift = 1.0m, EffectiveFrom = new DateTime(2000, 01, 01), EffectiveTo = new DateTime(2015, 07, 31), }; var efaDisadvatageTwo = new EfaDisadvantage { Postcode = "CV1 2WT", Uplift = uplift, EffectiveFrom = new DateTime(2015, 08, 01), EffectiveTo = new DateTime(2020, 07, 31), }; var efaDisadvantages = new List <EfaDisadvantage>() { efaDisadvantageOne, efaDisadvatageTwo }; var postcodesReferenceDataServiceMock = new Mock <IPostcodesReferenceDataService>(); var organisationsDataServiceMock = new Mock <IOrganisationReferenceDataService>(); postcodesReferenceDataServiceMock.Setup(p => p.LatestEFADisadvantagesUpliftForPostcode(learner.Postcode)).Returns(efaDisadvatageTwo.Uplift); organisationsDataServiceMock.Setup(l => l.SpecialistResourcesForCampusIdentifier(It.IsAny <string>())).Returns(new List <CampusIdentifierSpecResource>()); var dataEntity = NewService( organisationReferenceDataService: organisationsDataServiceMock.Object, postcodesReferenceDataService: postcodesReferenceDataServiceMock.Object) .BuildLearnerDataEntity(learner); dataEntity.EntityName.Should().Be("Learner"); dataEntity.Attributes.Should().HaveCount(14); dataEntity.Attributes["DateOfBirth"].Value.Should().Be(learner.DateOfBirth); dataEntity.Attributes["EngGrade"].Value.Should().Be(learner.EngGrade); dataEntity.Attributes["LearnRefNumber"].Value.Should().Be(learner.LearnRefNumber); dataEntity.Attributes["LrnFAM_ECF"].Value.Should().Be(1); dataEntity.Attributes["LrnFAM_EDF1"].Value.Should().Be(2); dataEntity.Attributes["LrnFAM_EDF2"].Value.Should().Be(3); dataEntity.Attributes["LrnFAM_EHC"].Value.Should().Be(4); dataEntity.Attributes["LrnFAM_HNS"].Value.Should().Be(5); dataEntity.Attributes["LrnFAM_MCF"].Value.Should().Be(6); dataEntity.Attributes["MathGrade"].Value.Should().Be(learner.MathGrade); dataEntity.Attributes["PlanEEPHours"].Value.Should().Be(learner.PlanEEPHours); dataEntity.Attributes["PlanLearnHours"].Value.Should().Be(learner.PlanLearnHours); dataEntity.Attributes["PostcodeDisadvantageUplift"].Value.Should().Be(uplift); dataEntity.Attributes["ULN"].Value.Should().Be(learner.ULN); dataEntity.Children.Should().BeEmpty(); }