public void EventsFromDifferentApprenticeships_Programme__Should_NotBeGrouped() { var testInput = new List <DatalockEvent> { new DatalockEvent { AcademicYear = 2021, LearningAimPathwayCode = 1, LearningAimStandardCode = 2, LearningAimFrameworkCode = 31, LearningAimProgrammeType = 4, LearningAimReference = "123", PriceEpisodes = new List <DatalockEventPriceEpisode>(), }, new DatalockEvent { AcademicYear = 2021, LearningAimPathwayCode = 1, LearningAimStandardCode = 2, LearningAimFrameworkCode = 3, LearningAimProgrammeType = 4, LearningAimReference = "123", PriceEpisodes = new List <DatalockEventPriceEpisode>(), } }; var sut = new MatchedLearnerDtoMapper(); var actual = sut.Map(testInput); actual.Training.Should().HaveCount(2); }
public void Training_Should_HaveTwoElements() { var sut = new MatchedLearnerDtoMapper(); var actual = sut.Map(_testInput); actual.Training.Should().HaveCount(2); }
public void Training_Should_BeInOutput() { var sut = new MatchedLearnerDtoMapper(); var actual = sut.Map(_testInput); actual.Training.Should().ContainEquivalentOf(new { PathwayCode = 1 }); }
public void WhenNonPayablePeriodApprenticeshipIsNull_ThenExceptionNotThrown() { //Arrange var eventId = Guid.NewGuid(); var testInput = new MatchedLearnerDataLockInfo { //TODO: Fix this //LatestSuccessfulJobs = new List<LatestSuccessfulJobModel> //{ // new LatestSuccessfulJobModel // { // CollectionPeriod = 1, // AcademicYear = 2021, // IlrSubmissionTime = DateTime.Now, // Ukprn = 1234, // JobId = 2, // DcJobId = 2, // } //}, DataLockEvents = new List <DataLockEventModel> { new DataLockEventModel { EventId = eventId, AcademicYear = 2021, LearningAimPathwayCode = 1, LearningAimStandardCode = 2, LearningAimFrameworkCode = 31, LearningAimProgrammeType = 4, LearningAimReference = "123", } }, DataLockEventNonPayablePeriods = new List <DataLockEventNonPayablePeriodModel> { new DataLockEventNonPayablePeriodModel { Id = 1, Amount = 0, DataLockEventId = eventId, DeliveryPeriod = 8, PriceEpisodeIdentifier = "3-490-1-01/08/2020", TransactionType = 2 } } }; //Act var sut = new MatchedLearnerDtoMapper(); //Assert Assert.DoesNotThrow(() => { sut.Map(testInput); }); }
public void InputWithPayablePeriod_Should_ProducePeriodWithIsPayableTrue() { var sut = new MatchedLearnerDtoMapper(); var actual = sut.Map(_testInput); actual.Training .SelectMany(x => x.PriceEpisodes) .SelectMany(x => x.Periods) .Should().ContainEquivalentOf(new { IsPayable = true }); }
public void ThereShouldBe_NoMixingOfPeriodsBetweenPriceEpisodes() { var sut = new MatchedLearnerDtoMapper(); var actual = sut.Map(_testInput); var firstEvent = actual.Training.FirstOrDefault(x => x.PathwayCode == 1); firstEvent !.PriceEpisodes.SelectMany(x => x.Periods).Should().HaveCount(2); firstEvent.PriceEpisodes.SelectMany(x => x.Periods).Should().ContainEquivalentOf(new { Period = 2 }); firstEvent.PriceEpisodes.SelectMany(x => x.Periods).Should().ContainEquivalentOf(new { Period = 1 }); }
public void Training_Should_HaveExpectedPriceEpisodes() { var sut = new MatchedLearnerDtoMapper(); var actual = sut.Map(_testInput); actual.Training.First().PriceEpisodes.Should().HaveCount(2); actual.Training.First().PriceEpisodes.Should().ContainEquivalentOf(new { Identifier = "1-1-01/08/2020" }); actual.Training.First().PriceEpisodes.Should().ContainEquivalentOf(new { Identifier = "2-2-01/08/2020" }); actual.Training.Last().PriceEpisodes.Should().HaveCount(2); actual.Training.Last().PriceEpisodes.Should().ContainEquivalentOf(new { Identifier = "3-3-01/08/2020" }); actual.Training.Last().PriceEpisodes.Should().ContainEquivalentOf(new { Identifier = "4-4-01/08/2020" }); }
public void EventsFromDifferentApprenticeships_Programme__Should_NotBeGrouped() { var testInput = new MatchedLearnerDataLockInfo { //TODO: Fix this //LatestSuccessfulJobs = new List<LatestSuccessfulJobModel> //{ // new LatestSuccessfulJobModel // { // CollectionPeriod = 1, // AcademicYear = 2021, // IlrSubmissionTime = DateTime.Now, // Ukprn = 1234, // JobId = 2, // DcJobId = 2, // } //}, DataLockEvents = new List <DataLockEventModel> { new DataLockEventModel { AcademicYear = 2021, LearningAimPathwayCode = 1, LearningAimStandardCode = 2, LearningAimFrameworkCode = 31, LearningAimProgrammeType = 4, LearningAimReference = "123", }, new DataLockEventModel { AcademicYear = 2021, LearningAimPathwayCode = 1, LearningAimStandardCode = 2, LearningAimFrameworkCode = 3, LearningAimProgrammeType = 4, LearningAimReference = "123", } } }; var sut = new MatchedLearnerDtoMapper(); var actual = sut.Map(testInput); actual.Training.Should().HaveCount(2); }
public void WhenPayablePeriodApprenticeshipIsNull_ThenExceptionNotThrown() { //Arrange var datalockEvents = new List <DatalockEvent> { new DatalockEvent { EventId = Guid.NewGuid(), AcademicYear = 2021, LearningAimPathwayCode = 1, LearningAimStandardCode = 2, LearningAimFrameworkCode = 31, LearningAimProgrammeType = 4, LearningAimReference = "123", PriceEpisodes = new List <DatalockEventPriceEpisode>(), PayablePeriods = new List <DatalockEventPayablePeriod> { new DatalockEventPayablePeriod { Id = 1, Amount = 0, Apprenticeship = null, ApprenticeshipId = 123, DataLockEventId = Guid.NewGuid(), DeliveryPeriod = 8, PriceEpisodeIdentifier = "3-490-1-01/08/2020", TransactionType = 2 } } } }; //Act var sut = new MatchedLearnerDtoMapper(); //Assert Assert.DoesNotThrow(() => { sut.Map(datalockEvents); }); }
public void Setup() { var testInput = new MatchedLearnerDataLockInfo { //TODO: Fix this //LatestSuccessfulJobs = new List<LatestSuccessfulJobModel> //{ // new LatestSuccessfulJobModel // { // CollectionPeriod = _expectedIlrSubmissionWindowPeriod, // AcademicYear = _expectedAcademicYear, // IlrSubmissionTime = _expectedIlrSubmissionDate, // Ukprn = _expectedUkprn, // JobId = 1, // DcJobId = 1, // } //}, DataLockEvents = new List <DataLockEventModel> { new DataLockEventModel { LearningStartDate = _expectedLearningStartDate, EventTime = _expectedEventTime, IlrSubmissionDateTime = _expectedIlrSubmissionDate, CollectionPeriod = _expectedIlrSubmissionWindowPeriod, AcademicYear = _expectedAcademicYear, Ukprn = _expectedUkprn, LearnerUln = _expectedUln, LearningAimReference = _expectedTrainingReference, LearningAimProgrammeType = _expectedTrainingProgrammeType, LearningAimStandardCode = _expectedTrainingStandardCode, LearningAimFrameworkCode = _expectedTrainingFrameworkCode, LearningAimPathwayCode = _expectedTrainingPathwayCode, LearningAimFundingLineType = _expectedTrainingFundingLineType, } }, DataLockEventPriceEpisodes = new List <DataLockEventPriceEpisodeModel> { new DataLockEventPriceEpisodeModel { StartDate = _expectedPriceEpisodeStartDate, ActualEndDate = _expectedPriceEpisodeEndDate, TotalNegotiatedPrice1 = 100m, TotalNegotiatedPrice2 = 200m, InstalmentAmount = _expectedPriceEpisodeInstalmentAmount, NumberOfInstalments = _expectedPriceEpisodeNumberOfInstalments, CompletionAmount = _expectedPriceEpisodeCompletionAmount, PriceEpisodeIdentifier = _expectedPriceEpisodeIdentifier, EffectiveTotalNegotiatedPriceStartDate = _expectedTotalNegotiatedPriceStartDate } }, DataLockEventNonPayablePeriods = new List <DataLockEventNonPayablePeriodModel> { new DataLockEventNonPayablePeriodModel { PriceEpisodeIdentifier = _expectedPriceEpisodeIdentifier, DeliveryPeriod = 2, } }, DataLockEventNonPayablePeriodFailures = new List <DataLockEventNonPayablePeriodFailureModel> { new DataLockEventNonPayablePeriodFailureModel { ApprenticeshipId = 123, DataLockFailureId = 2, }, new DataLockEventNonPayablePeriodFailureModel { ApprenticeshipId = 123, DataLockFailureId = 3, }, }, Apprenticeships = new List <ApprenticeshipModel> { new ApprenticeshipModel { Id = 123, ApprenticeshipEmployerType = _expectedApprenticeshipEmployerType }, new ApprenticeshipModel { Id = 456, ApprenticeshipEmployerType = _expectedApprenticeshipEmployerType } }, DataLockEventPayablePeriods = new List <DataLockEventPayablePeriodModel> { new DataLockEventPayablePeriodModel { PriceEpisodeIdentifier = _expectedPriceEpisodeIdentifier, ApprenticeshipId = 456, DeliveryPeriod = 1, }, } }; var sut = new MatchedLearnerDtoMapper(); _actual = sut.Map(testInput); }
public void Setup() { _testInput.Clear(); _testInput.Add(new DatalockEvent { LearningStartDate = _expectedLearningStartDate, EventTime = _expectedEventTime, IlrSubmissionDateTime = _expectedIlrSubmissionDate, CollectionPeriod = _expectedIlrSubmissionWindowPeriod, AcademicYear = _expectedAcademicYear, Ukprn = _expectedUkprn, LearnerUln = _expectedUln, LearningAimReference = _expectedTrainingReference, LearningAimProgrammeType = _expectedTrainingProgrammeType, LearningAimStandardCode = _expectedTrainingStandardCode, LearningAimFrameworkCode = _expectedTrainingFrameworkCode, LearningAimPathwayCode = _expectedTrainingPathwayCode, LearningAimFundingLineType = _expectedTrainingFundingLineType, PriceEpisodes = new List <DatalockEventPriceEpisode> { new DatalockEventPriceEpisode { StartDate = _expectedPriceEpisodeStartDate, ActualEndDate = _expectedPriceEpisodeEndDate, TotalNegotiatedPrice1 = 100m, TotalNegotiatedPrice2 = 200m, InstalmentAmount = _expectedPriceEpisodeInstalmentAmount, NumberOfInstalments = _expectedPriceEpisodeNumberOfInstalments, CompletionAmount = _expectedPriceEpisodeCompletionAmount, PriceEpisodeIdentifier = _expectedPriceEpisodeIdentifier, } }, NonPayablePeriods = new List <DatalockEventNonPayablePeriod> { new DatalockEventNonPayablePeriod { PriceEpisodeIdentifier = _expectedPriceEpisodeIdentifier, DeliveryPeriod = 2, Failures = new List <DatalockEventNonPayablePeriodFailure> { new DatalockEventNonPayablePeriodFailure { Apprenticeship = new Apprenticeship { Id = 123, ApprenticeshipEmployerType = _expectedApprenticeshipEmployerType, }, DataLockFailureId = 2, }, new DatalockEventNonPayablePeriodFailure { Apprenticeship = new Apprenticeship { Id = 123, ApprenticeshipEmployerType = _expectedApprenticeshipEmployerType, }, DataLockFailureId = 3, }, } }, }, PayablePeriods = new List <DatalockEventPayablePeriod> { new DatalockEventPayablePeriod { PriceEpisodeIdentifier = _expectedPriceEpisodeIdentifier, Apprenticeship = new Apprenticeship { ApprenticeshipEmployerType = _expectedApprenticeshipEmployerType, }, DeliveryPeriod = 1, }, } }); var sut = new MatchedLearnerDtoMapper(); _actual = sut.Map(_testInput); }