Exemplo n.º 1
0
        public void Arrange()
        {
            _fixture = new Fixture();

            _collectionYear = _fixture.Create <short>();

            _collectionPeriod = new CollectionPeriod(1, _collectionYear);

            _fixture.Build <PendingPaymentModel>().With(p => p.PendingPaymentValidationResultModels, new List <PendingPaymentValidationResultModel>()).Create();

            _sutModel = _fixture
                        .Build <ApprenticeshipIncentiveModel>()
                        .With(a => a.PendingPaymentModels, new List <PendingPaymentModel>()
            {
                _fixture.Build <PendingPaymentModel>().With(p => p.PendingPaymentValidationResultModels, new List <PendingPaymentValidationResultModel>()).Create()
            })
                        .Create();

            _sutModel.Apprenticeship.SetProvider(_fixture.Create <Provider>());

            _learner = Learner.New(
                Guid.NewGuid(),
                _sutModel.Id,
                _sutModel.Apprenticeship.Id,
                _sutModel.Apprenticeship.Provider.Ukprn,
                _sutModel.Apprenticeship.UniqueLearnerNumber);

            var submisssionData = new SubmissionData();

            submisssionData.SetSubmissionDate(DateTime.Now);
            _learner.SetSubmissionData(submisssionData);

            _sut = Sut(_sutModel);
        }
        public void Arrange()
        {
            _fixture = new Fixture();

            var collectionPeriods = new List <CollectionCalendarPeriod>()
            {
                new CollectionCalendarPeriod(new CollectionPeriod(1, _fixture.Create <short>()), _fixture.Create <byte>(), _fixture.Create <short>(), _fixture.Create <DateTime>(), _fixture.Create <DateTime>(), true, false),
            };
            var collectionCalendar = new CollectionCalendar(collectionPeriods);

            _mockCollectionCalendarService = new Mock <ICollectionCalendarService>();
            _mockCollectionCalendarService.Setup(m => m.Get()).ReturnsAsync(collectionCalendar);

            _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>().With(x => x.Status, IncentiveStatus.Active).Create();
            _sutModel.PendingPaymentModels = new List <PendingPaymentModel>();
            _sutModel.PendingPaymentModels.Add(_fixture.Build <PendingPaymentModel>().With(x => x.DueDate, new DateTime(2021, 1, 1)).With(x => x.ClawedBack, false).With(x => x.PaymentMadeDate, (DateTime?)null).Create());
            _sutModel.PendingPaymentModels.Add(_fixture.Build <PendingPaymentModel>().With(x => x.DueDate, new DateTime(2021, 2, 28)).With(x => x.ClawedBack, false).With(x => x.PaymentMadeDate, (DateTime?)null).Create());
            _sutModel.PaymentModels         = new List <PaymentModel>();
            _sutModel.ClawbackPaymentModels = new List <ClawbackPaymentModel>();
            _sut = Sut(_sutModel);

            var learningData = new LearningData(true);

            learningData.SetIsStopped(new LearningStoppedStatus(true, _sutModel.PendingPaymentModels.Last().DueDate.AddDays(-1)));
            var submissionData = new SubmissionData();

            submissionData.SetSubmissionDate(DateTime.Now);
            submissionData.SetLearningData(learningData);
            _learner = Learner.New(_fixture.Create <Guid>(), _sutModel.Id, _fixture.Create <long>(), _fixture.Create <long>(), _fixture.Create <long>());
            _learner.SetSubmissionData(submissionData);
        }
Exemplo n.º 3
0
        public void Arrange()
        {
            _fixture = new Fixture();

            _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>().With(x => x.RefreshedLearnerForEarnings, false).Create();

            _sut = Sut(_sutModel);
        }
        public void Arrange()
        {
            _fixture = new Fixture();

            _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>().With(p => p.HasPossibleChangeOfCircumstances, false).Create();

            _sut = Sut(_sutModel);
        }
Exemplo n.º 5
0
        public void Arrange()
        {
            _fixture = new Fixture();

            _sutModel = _fixture.Create <ApprenticeshipIncentiveModel>();
            _sutModel.PendingPaymentModels = new List <PendingPaymentModel>(_fixture.CreateMany <PendingPaymentModel>(3));

            _sut = Sut(_sutModel);
        }
Exemplo n.º 6
0
        public void Arrange()
        {
            _fixture = new Fixture();

            _collectionPeriod = new DateTime(2021, 10, 1);
            _plannedStartDate = _collectionPeriod.AddDays(5);

            _firstPaymentDaysAfterApprenticeshipStart  = 10;
            _secondPaymentDaysAfterApprenticeshipStart = 50;

            _paymentProfiles = new IncentivePaymentProfileListBuilder()
                               .WithIncentivePaymentProfiles(
                new List <IncentivePaymentProfile>()
            {
                new IncentivePaymentProfile(
                    new IncentivePhase(Phase.Phase2),
                    new List <PaymentProfile>
                {
                    new PaymentProfile(IncentiveType.UnderTwentyFiveIncentive, _firstPaymentDaysAfterApprenticeshipStart, 100),
                    new PaymentProfile(IncentiveType.UnderTwentyFiveIncentive, _secondPaymentDaysAfterApprenticeshipStart, 300),
                    new PaymentProfile(IncentiveType.TwentyFiveOrOverIncentive, _firstPaymentDaysAfterApprenticeshipStart, 200),
                    new PaymentProfile(IncentiveType.TwentyFiveOrOverIncentive, _secondPaymentDaysAfterApprenticeshipStart, 400)
                }
                    )
            })
                               .Build();

            _collectionPeriods = new List <CollectionCalendarPeriod>()
            {
                new CollectionCalendarPeriod(new CollectionPeriod(1, _fixture.Create <short>()), (byte)_collectionPeriod.AddMonths(-1).Month, (short)_collectionPeriod.AddMonths(-1).Year, _collectionPeriod.AddMonths(-1).AddDays(1), _fixture.Create <DateTime>(), false, false),
                new CollectionCalendarPeriod(new CollectionPeriod(2, _fixture.Create <short>()), (byte)_collectionPeriod.AddMonths(1).Month, (short)_collectionPeriod.AddMonths(1).Year, _collectionPeriod.AddMonths(1).AddDays(1), _fixture.Create <DateTime>(), false, false),
                new CollectionCalendarPeriod(new CollectionPeriod(3, _fixture.Create <short>()), (byte)_collectionPeriod.AddMonths(2).Month, (short)_collectionPeriod.AddMonths(2).Year, _collectionPeriod.AddMonths(2).AddDays(1), _fixture.Create <DateTime>(), false, false)
            };

            _collectionCalendar = new CollectionCalendar(_collectionPeriods);

            _mockCollectionCalendarService = new Mock <ICollectionCalendarService>();
            _mockCollectionCalendarService.Setup(m => m.Get()).ReturnsAsync(_collectionCalendar);

            _mockPaymentProfilesService = new Mock <IIncentivePaymentProfilesService>();
            _mockPaymentProfilesService.Setup(m => m.Get()).ReturnsAsync(_paymentProfiles);

            _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>()
                        .With(x => x.Status, IncentiveStatus.Active)
                        .With(x => x.Phase, new IncentivePhase(Phase.Phase2))
                        .Create();
            _apprenticehip                  = _sutModel.Apprenticeship;
            _sutModel.StartDate             = _plannedStartDate;
            _sutModel.PendingPaymentModels  = new List <PendingPaymentModel>();
            _sutModel.PaymentModels         = new List <PaymentModel>();
            _sutModel.ClawbackPaymentModels = new List <ClawbackPaymentModel>();
            _sut = Sut(_sutModel);
        }
Exemplo n.º 7
0
        public void Arrange()
        {
            _fixture          = new Fixture();
            _collectionPeriod = _fixture.Create <CollectionPeriod>();

            _fixture.Customize <PendingPaymentValidationResultModel>(x =>
                                                                     x.With(y => y.Result, true)
                                                                     .With(x => x.CollectionPeriod, _collectionPeriod));
            _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>().With(x => x.PaymentModels, new List <PaymentModel>()).Create();

            _sut = Sut(_sutModel);
        }
        public void Arrange()
        {
            _fixture = new Fixture();

            _fixture.Build <PendingPaymentModel>().With(p => p.PendingPaymentValidationResultModels, new List <PendingPaymentValidationResultModel>()).Create();

            _sutModel = _fixture
                        .Build <ApprenticeshipIncentiveModel>()
                        .With(a => a.PendingPaymentModels, new List <PendingPaymentModel>()
            {
                _fixture.Build <PendingPaymentModel>().With(p => p.PendingPaymentValidationResultModels, new List <PendingPaymentValidationResultModel>()).Create()
            })
                        .With(a => a.PaymentModels, new List <PaymentModel>())
                        .Create();

            _mockCollectionCalendarService = new Mock <ICollectionCalendarService>();

            _sut = Sut(_sutModel);
        }
        public void Arrange()
        {
            _fixture = new Fixture();

            _collectionYear = _fixture.Create <short>();

            _collectionPeriod = new CollectionPeriod(1, _collectionYear);

            var startDate = DateTime.Now.Date;
            var dueDate   = startDate.AddDays(90).Date;

            _sutModel = _fixture
                        .Build <ApprenticeshipIncentiveModel>()
                        .With(a => a.StartDate, startDate)
                        .With(a => a.PendingPaymentModels, new List <PendingPaymentModel>()
            {
                _fixture.Build <PendingPaymentModel>()
                .With(p => p.DueDate, dueDate)
                .With(p => p.PendingPaymentValidationResultModels, new List <PendingPaymentValidationResultModel>()).Create()
            })
                        .Create();

            _sutModel.Apprenticeship.SetProvider(_fixture.Create <Provider>());

            _learnerModel = _fixture
                            .Build <LearnerModel>()
                            .With(l => l.DaysInLearnings, new List <DaysInLearning>()
            {
                new DaysInLearning(_collectionPeriod, 90)
            })
                            .Create();

            _learner = Learner.Get(_learnerModel);

            _sut = Sut(_sutModel);
        }
Exemplo n.º 10
0
        public void Then_the_payment_is_created(DateTime dob, DateTime plannedStartDate, ApprenticeshipEmployerType employerType, SubnominalCode expectedSubnominalCode)
        {
            // arrange
            var apprenticeship = new Apprenticeship(_fixture.Create <long>(), _fixture.Create <string>(),
                                                    _fixture.Create <string>(), dob, _fixture.Create <long>(), employerType, _fixture.Create <string>(), _fixture.Create <DateTime>());

            _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>()
                        .With(x => x.StartDate, plannedStartDate)
                        .With(x => x.Apprenticeship, apprenticeship)
                        .With(x => x.PaymentModels, new List <PaymentModel>()).Create();

            _sut = Sut(_sutModel);

            var pendingPayment = _sut.PendingPayments.First();

            // act
            _sut.CreatePayment(pendingPayment.Id, _collectionPeriod);

            // assert
            _sut.Payments.Count.Should().Be(1);
            var actualPayment = _sut.Payments.First();

            actualPayment.SubnominalCode.Should().Be(expectedSubnominalCode);
        }