public void Setup()
        {
            Fixture fixture = new Fixture();

            fixture.Customize <Apprenticeship>(ob => ob
                                               .With(x => x.ULN, ApprenticeshipTestDataHelper.CreateValidULN())
                                               );
            _validator = new CreateCommitmentValidator();
            var populatedCommitment = fixture.Build <Domain.Entities.Commitment>().Create();

            _exampleCommand = new CreateCommitmentCommand {
                Commitment = populatedCommitment
            };
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            _mockCommitmentRespository = new Mock <ICommitmentRepository>();
            _mockHashingService        = new Mock <IHashingService>();
            var commandValidator = new CreateCommitmentValidator();

            _mockHistoryRepository = new Mock <IHistoryRepository>();
            _handler = new CreateCommitmentCommandHandler(_mockCommitmentRespository.Object,
                                                          _mockHashingService.Object,
                                                          commandValidator,
                                                          Mock.Of <ICommitmentsLogger>(),
                                                          _mockHistoryRepository.Object);

            Fixture fixture = new Fixture();

            fixture.Customize <Apprenticeship>(ob => ob
                                               .With(x => x.ULN, ApprenticeshipTestDataHelper.CreateValidULN())
                                               .With(x => x.NINumber, ApprenticeshipTestDataHelper.CreateValidNino())
                                               .With(x => x.FirstName, "First name")
                                               .With(x => x.FirstName, "Last name")
                                               .With(x => x.ProviderRef, "Provider ref")
                                               .With(x => x.EmployerRef, null)
                                               .With(x => x.StartDate, DateTime.Now.AddYears(5))
                                               .With(x => x.EndDate, DateTime.Now.AddYears(7))
                                               .With(x => x.DateOfBirth, DateTime.Now.AddYears(-16))
                                               .With(x => x.TrainingCode, string.Empty)
                                               .With(x => x.TrainingName, string.Empty)
                                               );
            _populatedCommitment = fixture.Build <Commitment>().Create();
            _populatedCommitment.Apprenticeships = new List <Apprenticeship>();

            _exampleValidRequest = new CreateCommitmentCommand
            {
                Commitment = _populatedCommitment,
                Caller     = new Caller(1L, CallerType.Employer),
                UserId     = "UserId"
            };
        }