public override void AssertDataLockEvents(DataLockContext context, LearnerResults[] results) { foreach (var expected in context.DataLockEventPeriods) { var actualEvent = GetEventsForPriceEpisode(results, expected.PriceEpisodeIdentifier).FirstOrDefault(); var actualPeriods = actualEvent.Periods.Where(e => e.CollectionPeriodName == expected.Period).ToArray(); if (!actualPeriods.Any()) { throw new Exception($"Event for price episode {expected.PriceEpisodeIdentifier} does not contain period {expected.Period}"); } var actual = actualPeriods.FirstOrDefault(e => e.TransactionType == (int)expected.TransactionType); if (actual == null) { var found = actualPeriods.Select(e => e.TransactionType.ToString()).Aggregate((x, y) => $"{x}\n{y}"); throw new Exception($"Expected a transaction type of {expected.TransactionType} in period {expected.Period} but none found.\n\nFound:\n{found}"); } if (expected.PayableFlag != actual.IsPayable) { //TODO: Ticket Created : DPP-718 //TODO: fix the payable flag issue in DataLock as its not attaching correct version for commitment in payments due for additiona payments e.g. 16-18 incentive //throw new Exception($"Expected payable flag of {expected.PayableFlag} but actually {actual.IsPayable}"); } } }
public DataLockSteps(DataLockContext dataLockContext, CommitmentsContext commitmentsContext, SubmissionContext submissionContext, EmployerAccountContext employerAccountContext, LookupContext lookupContext) { DataLockContext = dataLockContext; CommitmentsContext = commitmentsContext; SubmissionContext = submissionContext; EmployerAccountContext = employerAccountContext; LookupContext = lookupContext; }
private static void ParseDataLockStatusRows(DataLockContext context, string learnerId, Table dataLockStatusTable, string[] periodNames) { foreach (var row in dataLockStatusTable.Rows) { if (row[0] == "On-program") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForOnProgramme); } else if (row[0] == "Completion") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForCompletion); } else if (row[0] == "Balancing") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForBalancing); } else if (row[0] == "Employer 16-18 incentive") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForEmployer16To18Incentive); } else if (row[0] == "Provider 16-18 incentive") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForProvider16To18Incentive); } else if (row[0] == "English and maths on programme") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForEnglishAndMathOnProgramme); } else if (row[0] == "English and maths Balancing") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForEnglishAndMathBalancing); } else if (row[0] == "Provider disadvantage uplift") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForDisadvantageUplift); } else if (row[0] == "Framework uplift on-program") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForFrameworkUpliftOnProgramme); } else if (row[0] == "Framework uplift completion") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForFrameworkUpliftCompletion); } else if (row[0] == "Framework uplift balancing") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForFrameworkUpliftBalancing); } else if (row[0] == "Provider learning support") { ParseRow(learnerId, row, periodNames, context.DataLockStatusForLearningSupport); } else { throw new ArgumentException($"Unexpected data lock row type of '{row[0]}'"); } } }
internal static void ParseDataLockStatusTableIntoContext(DataLockContext dataLockContext, string learnerId, Table dataLockStatusTable) { if (dataLockStatusTable.Rows.Count < 1) { throw new ArgumentException("Data Lock status table must have at least 1 row"); } var periodNames = ParseDataLockStatusHeaders(dataLockStatusTable); ParseDataLockStatusRows(dataLockContext, learnerId, dataLockStatusTable, periodNames); }
public static void AssertDataLockOutput(DataLockContext context, LearnerResults[] results) { if (TestEnvironment.ValidateSpecsOnly) { return; } foreach (var rule in Rules) { rule.AssertDataLockEvents(context, results); } }
internal static void ParseDataLockEventErrorsIntoContext(DataLockContext context, Table dataLockEventErrors, LookupContext lookupContext) { if (dataLockEventErrors.Rows.Count < 1) { throw new ArgumentOutOfRangeException("Data lock event errors table must have at least 1 row"); } var structure = ParseDataLockEventsTableStructure(dataLockEventErrors); foreach (var row in dataLockEventErrors.Rows) { context.DataLockEventErrors.Add(ParseDataLockEventsRow(row, structure, lookupContext)); } }
public override void AssertDataLockEvents(DataLockContext context, LearnerResults[] results) { if (context.ExpectsNoDataLockEvents) { var numberOfDataLockErrors = results.SelectMany(l => l.DataLockEvents).Count(); if (numberOfDataLockErrors > 0) { throw new Exception($"Did not expect any data lock errors, however found {numberOfDataLockErrors}"); } return; } foreach (var expected in context.DataLockEvents) { var eventsForPriceEpisode = GetEventsForPriceEpisode(results, expected.PriceEpisodeIdentifier); var actual = eventsForPriceEpisode.FirstOrDefault(x => x.CommitmentId == expected.ApprenticeshipId); if (actual == null) { var foundCommitmentIds = eventsForPriceEpisode.Any() ? eventsForPriceEpisode.Select(x => x.CommitmentId.ToString()).Distinct().Aggregate((x, y) => $"{x}, {y}") : "no commitment ids"; throw new Exception($"Expected event to have commitment id {expected.ApprenticeshipId} but actually had {foundCommitmentIds}"); } if (expected.Uln != actual.Uln) { throw new Exception($"Expected event to have ULN {expected.Uln} but actually had {actual.Uln}"); } if (expected.IlrStartDate != actual.IlrStartDate) { throw new Exception($"Expected event to have start date {expected.IlrStartDate} but actually had {actual.IlrStartDate}"); } if (expected.IlrTrainingPrice != actual.IlrTrainingPrice) { throw new Exception($"Expected event to have training price {expected.IlrTrainingPrice} but actually had {actual.IlrTrainingPrice}"); } if (expected.IlrEndpointAssementPrice != actual.IlrEndpointAssessorPrice) { throw new Exception($"Expected event to have endpoint assessment price {expected.IlrEndpointAssementPrice} but actually had {actual.IlrEndpointAssessorPrice}"); } if (expected.ILrEffectiveFrom != actual.IlrPriceEffectiveFromDate) { throw new Exception($"Expected event to have effective from date of {expected.ILrEffectiveFrom} but actually had {actual.IlrPriceEffectiveFromDate}"); } if (expected.ILrEffectiveTo.HasValue && expected.ILrEffectiveTo != actual.IlrPriceEffectiveToDate) { throw new Exception($"Expected event to have effective to date of {expected.ILrEffectiveTo} but actually had {actual.IlrPriceEffectiveToDate}"); } } }
public EarningAndPaymentSteps(EmployerAccountContext employerAccountContext, EarningsAndPaymentsContext earningsAndPaymentsContext, DataLockContext dataLockContext, SubmissionContext submissionContext, LookupContext lookupContext, CommitmentsContext commitmentsContext) { EmployerAccountContext = employerAccountContext; EarningsAndPaymentsContext = earningsAndPaymentsContext; DataLockContext = dataLockContext; SubmissionContext = submissionContext; LookupContext = lookupContext; CommitmentsContext = commitmentsContext; }
public override void AssertDataLockEvents(DataLockContext context, LearnerResults[] results) { foreach (var expected in context.DataLockEventCommitments) { var actual = GetEventsForPriceEpisode(results, expected.PriceEpisodeIdentifier) .SelectMany(x => x.CommitmentVersions) .FirstOrDefault(e => e.CommitmentVersion == expected.ApprenticeshipVersion); if (actual == null) { throw new Exception($"Event for price episode {expected.PriceEpisodeIdentifier} does not contain commitment version with with version id {expected.ApprenticeshipVersion}"); } if (expected.StandardCode > 0) { if (expected.StandardCode != actual.CommitmentStandardCode) { throw new Exception($"Expected programe type of {expected.StandardCode} but actually {actual.CommitmentStandardCode}"); } } else { if (expected.ProgrammeType != actual.CommitmentProgrammeType) { throw new Exception($"Expected programe type of {expected.ProgrammeType} but actually {actual.CommitmentProgrammeType}"); } if (expected.FrameworkCode != actual.CommitmentFrameworkCode) { throw new Exception($"Expected programe type of {expected.FrameworkCode} but actually {actual.CommitmentFrameworkCode}"); } if (expected.PathwayCode != actual.CommitmentPathwayCode) { throw new Exception($"Expected programe type of {expected.PathwayCode} but actually {actual.CommitmentPathwayCode}"); } } if (expected.StartDate != actual.CommitmentStartDate) { throw new Exception($"Expected start date of {expected.StartDate} but actually {actual.CommitmentStartDate}"); } if (expected.NegotiatedPrice != actual.CommitmentNegotiatedPrice) { throw new Exception($"Expected negotiated price of {expected.NegotiatedPrice} but actually {actual.CommitmentNegotiatedPrice}"); } if (expected.EffectiveDate != actual.CommitmentEffectiveDate) { throw new Exception($"Expected effective date of {expected.EffectiveDate} but actually {actual.CommitmentEffectiveDate}"); } } }
public override void AssertDataLockEvents(DataLockContext context, LearnerResults[] results) { foreach (var expected in context.DataLockEventErrors) { var actualEvent = GetEventsForPriceEpisode(results, expected.PriceEpisodeIdentifier).FirstOrDefault(); var actual = actualEvent.Errors.FirstOrDefault(e => e.ErrorCode == expected.ErrorCode); if (actual == null) { throw new Exception($"Event for price episode {expected.PriceEpisodeIdentifier} does not contain error with code {expected.ErrorCode}"); } if (expected.ErrorDescription != actual.SystemDescription) { throw new Exception($"Expected error description '{expected.ErrorDescription}' but actually '{actual.SystemDescription}'"); } } }
public static void AssertPaymentsAndEarningsResults(DataLockContext dataLockContext, SubmissionContext submissionContext) { if (TestEnvironment.ValidateSpecsOnly) { return; } var submissionResults = submissionContext.SubmissionResults.ToArray(); new OnProgrammeDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForOnProgramme, submissionResults); new CompletionDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForCompletion, submissionResults); new BalancingDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForBalancing, submissionResults); new DisadvantageUpliftDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForDisadvantageUplift, submissionResults); new Employer16To18IncentiveDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForEmployer16To18Incentive, submissionResults); new Provider16To18IncentiveDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForProvider16To18Incentive, submissionResults); new EnglishAndMathsOnProgrammeDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForEnglishAndMathOnProgramme, submissionResults); new EnglishAndMathsBalancingDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForEnglishAndMathBalancing, submissionResults); new FrameworkUpliftOnProgrammeDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForFrameworkUpliftOnProgramme, submissionResults); new FrameworkUpliftCompletionDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForFrameworkUpliftCompletion, submissionResults); new FrameworkUpliftBalancingDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForFrameworkUpliftBalancing, submissionResults); new LearningSupportDataLockRule().AssertPaymentTypeDataLockMatches(dataLockContext.DataLockStatusForLearningSupport, submissionResults); }
public abstract void AssertDataLockEvents(DataLockContext context, LearnerResults[] results);
public DataLockSteps(DataLockContext dataLockContext) { DataLockContext = dataLockContext; }