public async Task Builds_an_event_with_errors(
            DataLockErrorCode errorCode,
            string description,
            [Frozen] Mock <IApprenticeshipRepository> repository,
            PriceEpisodeStatusChangeBuilder sut,
            EarningFailedDataLockMatching dataLock,
            List <EarningPeriod> periods,
            List <DataLockFailure> dataLockFailures,
            ApprenticeshipModel apprenticeships)
        {
            CommonTestSetup(repository, dataLock, periods, new List <ApprenticeshipModel> {
                apprenticeships
            }, dataLockFailures);
            var priceEpisode = dataLock.PriceEpisodes[0];

            periods[0].DataLockFailures[0].DataLockError = errorCode;

            var result = await sut.Build(
                new List <DataLockEvent> {
                dataLock
            },
                new List <(string identifier, PriceEpisodeStatus status)>
            {
                (priceEpisode.Identifier, PriceEpisodeStatus.New)
            },
                new List <PriceEpisodeStatusChange>(), dataLock.CollectionPeriod.AcademicYear);

            result.Should().NotBeEmpty();
            result[0].Errors.Should().ContainEquivalentOf(new
            {
                DataLockEventId   = result[0].DataLock.DataLockEventId,
                ErrorCode         = errorCode.ToString(),
                SystemDescription = description,
            });
        }
Пример #2
0
        private string GetDataLockDescription(DataLockErrorCode dlockCode)
        {
            switch (dlockCode)
            {
            case DataLockErrorCode.DLOCK_01: return("No matching record found in an employer digital account for the UKPRN");

            case DataLockErrorCode.DLOCK_03: return("No matching record found in the employer digital account for the standard code");

            case DataLockErrorCode.DLOCK_04: return("No matching record found in the employer digital account for the framework code");

            case DataLockErrorCode.DLOCK_05: return("No matching record found in the employer digital account for the programme type");

            case DataLockErrorCode.DLOCK_06: return("No matching record found in the employer digital account for the pathway code");

            case DataLockErrorCode.DLOCK_07: return("No matching record found in the employer digital account for the negotiated cost of training");

            case DataLockErrorCode.DLOCK_08: return("Multiple matching records found in the employer digital account");

            case DataLockErrorCode.DLOCK_09: return("The start date for this negotiated price is before the corresponding price start date in the employer digital account");

            case DataLockErrorCode.DLOCK_10: return("The employer has stopped payments for this apprentice");

            case DataLockErrorCode.DLOCK_11: return("The employer is not currently a levy payer");

            case DataLockErrorCode.DLOCK_12: return("DLOCK_12");

            default: return(dlockCode.ToString());
            }
        }