public void Arrange()
 {
     _sut     = new IncentiveApplicationFactory();
     _fixture = new Fixture();
     _id      = _fixture.Create <Guid>();
     _model   = _fixture.Create <IncentiveApplicationModel>();
 }
        public async Task Then_changes_to_the_application_are_persisted_to_the_domain_repository_for_matching_ULNs()
        {
            //Arrange
            var command = _fixture.Create <ComplianceWithdrawalCommand>();

            var apprenticeshipModel = _fixture
                                      .Build <ApprenticeshipModel>()
                                      .With(a => a.ULN, command.ULN)
                                      .Create();

            var incentiveApplicationModel = _fixture
                                            .Build <IncentiveApplicationModel>()
                                            .With(i => i.ApprenticeshipModels,
                                                  new List <ApprenticeshipModel> {
                _fixture.Create <ApprenticeshipModel>(),
                apprenticeshipModel,
                _fixture.Create <ApprenticeshipModel>(),
            })
                                            .Create();

            var testApplication = new IncentiveApplicationFactory().GetExisting(incentiveApplicationModel.Id, incentiveApplicationModel);

            var applications = new List <IncentiveApplication>()
            {
                _fixture.Create <IncentiveApplication>(),
                testApplication,
                _fixture.Create <IncentiveApplication>()
            };

            _mockDomainRepository
            .Setup(m => m.Find(command))
            .ReturnsAsync(applications);

            //Act
            await _sut.Handle(command);

            //Assert
            _mockDomainRepository
            .Verify(m => m.Save(It.Is <IncentiveApplication>(a =>
                                                             a.Id == testApplication.Id &&
                                                             a.Apprenticeships.Count(a =>
                                                                                     a.ULN == command.ULN &&
                                                                                     a.WithdrawnByCompliance) == 1)),
                    Times.Once);
        }
Exemple #3
0
        private Apprenticeship CreateApprenticeship(DateTime startDate, DateTime dateOfBirth)
        {
            var apprenticeship = new IncentiveApplicationFactory().CreateApprenticeship(_fixture.Create <long>(), _fixture.Create <string>(), _fixture.Create <string>(), dateOfBirth, _fixture.Create <long>(), startDate, ApprenticeshipEmployerType.Levy, _fixture.Create <long>(), _fixture.Create <string>(), _fixture.Create <DateTime>());

            return(apprenticeship);
        }
Exemple #4
0
 public void Arrange()
 {
     _sut     = new IncentiveApplicationFactory();
     _fixture = new Fixture();
 }
Exemple #5
0
        public void Then_the_has_eligible_employer_start_is_set_correctly_based_on_the_employer_start_date(DateTime?employerStartDate, bool isEligible)
        {
            var apprenticeship = new IncentiveApplicationFactory().CreateApprenticeship(_fixture.Create <long>(), _fixture.Create <string>(), _fixture.Create <string>(), _fixture.Create <DateTime>(), _fixture.Create <long>(), _fixture.Create <DateTime>(), ApprenticeshipEmployerType.Levy, _fixture.Create <long>(), _fixture.Create <string>(), employerStartDate);

            apprenticeship.HasEligibleEmploymentStartDate.Should().Be(isEligible);
        }