Ejemplo n.º 1
0
        public async Task ThenNoProviderPaymentsWillBeRecorded(string providerIdentifier)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);
            var matcher  = new ProviderPaymentModelMatcher(provider, DataContext, TestSession, CurrentCollectionPeriod);

            await WaitForUnexpected(() => matcher.MatchUnexpectedEvents(), "Recorded payments check failed").ConfigureAwait(false);
        }
Ejemplo n.º 2
0
        public async Task ThenAtMonthEndNoPaymentsWillBeCalculatedForProvider(string providerIdentifier)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);
            var matcher  = new RequiredPaymentEventMatcher(provider, CurrentCollectionPeriod);

            await WaitForUnexpected(() => matcher.MatchUnexpectedEvents(), "Required Payment event check failure").ConfigureAwait(false);
        }
        public async Task ThenNoProviderPaymentsWillBeGenerated(string providerIdentifier)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);
            var matcher  = new ProviderPaymentEventMatcher(provider, CurrentCollectionPeriod, TestSession);

            await WaitForUnexpected(() => matcher.MatchUnexpectedEvents(), "Provider Payment event check failure");
        }
Ejemplo n.º 4
0
        public void GivenThePreviouslySubmittedTheFollowingLearnerDetails(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            var newIlrSubmission = table.CreateSet <Training>().ToList();

            AddTestLearners(newIlrSubmission, provider.Ukprn);

            if (PreviousIlr == null)
            {
                PreviousIlr = new List <Training>();
            }

            PreviousIlr.AddRange(newIlrSubmission);
        }
Ejemplo n.º 5
0
        public void GivenTheFollowingEarningsHadBeenGeneratedForTheLearnerFor(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);
            var previousProviderEarnings = CreateEarnings(table, provider.Ukprn);

            if (PreviousEarnings == null)
            {
                PreviousEarnings = new List <Earning>();
            }

            PreviousEarnings.AddRange(previousProviderEarnings);

            // for new style specs where no ILR specified
            if (PreviousIlr == null || PreviousIlr.All(u => u.Ukprn != provider.Ukprn))
            {
                var providerPreviousIlr = CreateTrainingFromLearners(provider.Ukprn);
                PreviousIlr.AddRange(providerPreviousIlr);
            }
        }
Ejemplo n.º 6
0
        public async Task ThenTheFollowingDataLockFailuresWereGeneratedForAsync(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            await ValidateDataLockError(table, provider).ConfigureAwait(false);
        }
Ejemplo n.º 7
0
        public async Task ThenAtMonthEndOnlyTheFollowingPaymentsWillBeCalculatedFor(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            await MatchRequiredPayments(table, provider).ConfigureAwait(false);
        }
Ejemplo n.º 8
0
        public async Task ThenTheFollowingLearnerEarningsShouldBeGeneratedFor(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            await GeneratedAndValidateEarnings(table, provider).ConfigureAwait(false);
        }
Ejemplo n.º 9
0
        public void GivenTheNowChangesTheLearnerDetailsAsFollows(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            AddNewIlr(table, provider.Ukprn);
        }
Ejemplo n.º 10
0
        public async Task GivenTheFollowingPaymentsHadBeenGenerated(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            await GeneratePreviousPayment(table, provider.Ukprn);
        }
Ejemplo n.º 11
0
        public async Task ThenOnlyTheFollowingPaymentsWillBeRecorded(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            await ValidateRecordedProviderPayments(table, provider);
        }
Ejemplo n.º 12
0
        public async Task WhenIlrFileIsSubmittedForTheLearnersInCollectionPeriod(string collectionPeriodText, string providerIdentifier)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            await HandleIlrReSubmissionForTheLearners(collectionPeriodText, provider).ConfigureAwait(false);
        }
        public static ApprenticeshipModel CreateApprenticeshipModel(Apprenticeship apprenticeshipSpec, TestSession testSession)
        {
            if (apprenticeshipSpec.ApprenticeshipId == default(long))
            {
                apprenticeshipSpec.ApprenticeshipId = testSession.GenerateId();
            }

            if (apprenticeshipSpec.Ukprn == default(long))
            {
                if (string.IsNullOrWhiteSpace(apprenticeshipSpec.Provider))
                {
                    apprenticeshipSpec.Ukprn = testSession.Ukprn;
                }
                else
                {
                    apprenticeshipSpec.Ukprn = testSession.GetProviderByIdentifier(apprenticeshipSpec.Provider).Ukprn;
                }
            }

            var employer = testSession.GetEmployer(apprenticeshipSpec.Employer);

            if (apprenticeshipSpec.AccountId == default(long))
            {
                apprenticeshipSpec.AccountId = employer.AccountId;
            }

            if (!string.IsNullOrEmpty(apprenticeshipSpec.SendingEmployer) && !apprenticeshipSpec.SenderAccountId.HasValue)
            {
                apprenticeshipSpec.SenderAccountId = testSession.GetEmployer(apprenticeshipSpec.SendingEmployer).AccountId;
            }

            if (apprenticeshipSpec.Uln == default(long))
            {
                var learnerId = string.IsNullOrWhiteSpace(apprenticeshipSpec.Identifier)
                    ? testSession.Learner.LearnerIdentifier
                    : apprenticeshipSpec.LearnerId;

                apprenticeshipSpec.Uln = testSession.GetLearner(apprenticeshipSpec.Ukprn, learnerId).Uln;
            }

            var apprenticeshipModel = new ApprenticeshipModel
            {
                Id        = apprenticeshipSpec.ApprenticeshipId,
                Ukprn     = apprenticeshipSpec.Ukprn,
                AccountId = apprenticeshipSpec.AccountId,
                TransferSendingEmployerAccountId = apprenticeshipSpec.SenderAccountId,
                Uln                = apprenticeshipSpec.Uln,
                FrameworkCode      = apprenticeshipSpec.FrameworkCode ?? 0, //TODO change when app bug is fixed
                ProgrammeType      = apprenticeshipSpec.ProgrammeType ?? 0,
                PathwayCode        = apprenticeshipSpec.PathwayCode ?? 0,
                StandardCode       = apprenticeshipSpec.StandardCode ?? 0,
                Priority           = apprenticeshipSpec.Priority,
                Status             = apprenticeshipSpec.Status.ToApprenticeshipPaymentStatus(),
                LegalEntityName    = "Test SFA",
                EstimatedStartDate = apprenticeshipSpec.StartDate.ToDate(),
                EstimatedEndDate   = apprenticeshipSpec.EndDate.ToDate(),
                AgreedOnDate       = string.IsNullOrWhiteSpace(apprenticeshipSpec.AgreedOnDate) ?
                                     DateTime.UtcNow :
                                     apprenticeshipSpec.AgreedOnDate.ToDate(),
                StopDate = string.IsNullOrWhiteSpace(apprenticeshipSpec.StopEffectiveFrom) ?
                           default(DateTime?) :
                           apprenticeshipSpec.StopEffectiveFrom.ToDate(),
                IsLevyPayer = employer.IsLevyPayer,
                ApprenticeshipEmployerType = GetApprenticeshipEmployerType(apprenticeshipSpec.EmployerType)
            };

            return(apprenticeshipModel);
        }
Ejemplo n.º 14
0
        public async Task ThenOnlyTheFollowingPaymentsWillBeGenerated(string providerIdentifier, Table table)
        {
            var provider = TestSession.GetProviderByIdentifier(providerIdentifier);

            await MatchOnlyProviderPayments(table, provider).ConfigureAwait(false);
        }