public void Arrange() { _fixture = new Fixture(); _collectionYear = _fixture.Create <short>(); _collectionMonth = _fixture.Create <byte>(); _collectionPeriod = new CollectionPeriod(1, _collectionMonth, _collectionYear, DateTime.Now, DateTime.Now, _collectionYear, true); 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.PeriodNumber, _collectionPeriod.AcademicYear, 90) }) .Create(); _learner = Learner.Get(_learnerModel); _sut = Sut(_sutModel); }
public void Then_a_validation_result_is_created_for_the_days_in_learning(int daysInLearning, bool validationResult) { // arrange var pendingPayment = _sut.PendingPayments.First(); _learnerModel.DaysInLearnings = new List <DaysInLearning>() { new DaysInLearning(_collectionPeriod, daysInLearning) }; _learner = Learner.Get(_learnerModel); // act _sut.ValidateDaysInLearning(pendingPayment.Id, _learner, _collectionPeriod); // assert pendingPayment.PendingPaymentValidationResults.Count.Should().Be(1); var validationresult = pendingPayment.PendingPaymentValidationResults.First(); validationresult.Step.Should().Be(ValidationStep.HasDaysInLearning); validationresult.CollectionPeriod.Should().Be(_collectionPeriod); validationresult.Result.Should().Be(validationResult); validationresult.GetModel().CreatedDateUtc.Should().Be(DateTime.Today); }
private Learner Sut(LearnerModel model) { return(Learner.Get(model)); }
public Learner GetExisting(LearnerModel model) { return(Learner.Get(model)); }