public void ContractTypeIsCorrectForFunctionalSkills(Type requiredPaymentEventType, ContractType expectedContractType) { var requiredPaymentEvent = Activator.CreateInstance(requiredPaymentEventType) as PeriodisedRequiredPaymentEvent; requiredPaymentEvent.ContractType = expectedContractType; IFunctionalSkillEarningEvent earningEvent = null; switch (expectedContractType) { case ContractType.Act1: earningEvent = new PayableFunctionalSkillEarningEvent { PriceEpisodes = new List <PriceEpisode>(), LearningAim = new LearningAim() }; break; case ContractType.Act2: earningEvent = new Act2FunctionalSkillEarningsEvent { PriceEpisodes = new List <PriceEpisode>(), LearningAim = new LearningAim() }; break; } var actual = mapper.Map(earningEvent, requiredPaymentEvent); actual.ContractType.Should().Be(expectedContractType); }
public void MathsAndEnglishRequiredMappingShouldMapEarningEventIdCorrectly(Type requiredPaymentEventType) { var earningEventId = Guid.NewGuid(); var requiredPaymentEvent = Activator.CreateInstance(requiredPaymentEventType) as PeriodisedRequiredPaymentEvent; var earningEvent = new PayableFunctionalSkillEarningEvent { EarningEventId = earningEventId }; var actual = mapper.Map(earningEvent, requiredPaymentEvent); actual.EarningEventId.Should().Be(earningEventId); }
public void MathsAndEnglishRequiredMappingShouldMapEarningEventIdCorrectly() { var earningEventId = Guid.NewGuid(); var requiredPaymentEvent = new CalculatedRequiredIncentiveAmount() as PeriodisedRequiredPaymentEvent; var earningEvent = new PayableFunctionalSkillEarningEvent { EarningEventId = earningEventId, PriceEpisodes = new List <PriceEpisode>(), LearningAim = new LearningAim() }; var actual = mapper.Map(earningEvent, requiredPaymentEvent); actual.EarningEventId.Should().Be(earningEventId); }
public async Task <ReadOnlyCollection <PeriodisedRequiredPaymentEvent> > HandlePayableFunctionalSkillEarningsEvent(PayableFunctionalSkillEarningEvent earningEvent, CancellationToken cancellationToken) { paymentLogger.LogVerbose($"Handling PayableFunctionalSkillEarningsEvent for jobId:{earningEvent.JobId} with apprenticeship key based on {logSafeApprenticeshipKeyString}"); using (var operation = telemetry.StartOperation("RequiredPaymentsService.HandleFunctionalSkillEarningsEvent", earningEvent.EventId.ToString())) { var stopwatch = Stopwatch.StartNew(); await ResetPaymentHistoryCacheIfDifferentCollectionPeriod(earningEvent.CollectionPeriod) .ConfigureAwait(false); await Initialise(earningEvent.CollectionPeriod.Period).ConfigureAwait(false); var requiredPaymentEvents = await functionalSkillEarningsEventProcessor.HandleEarningEvent(earningEvent, paymentHistoryCache, cancellationToken).ConfigureAwait(false); Log(requiredPaymentEvents); telemetry.TrackDuration("RequiredPaymentsService.HandleFunctionalSkillEarningsEvent", stopwatch, earningEvent); telemetry.StopOperation(operation); return(requiredPaymentEvents); } }