Exemplo n.º 1
0
        public CreateVacationHandlerTest(VacationTrackingDbContextFixture fixture)
        {
            _fixture = fixture;
            _logger  = new NullLogger <CreateVacationHandler>();

            //auto mapper configuration
            var mockMapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(typeof(Service.Mapper.AutoMapping));
            });

            _mapper = mockMapper.CreateMapper();

            _fixture.Initialize(true, () =>
            {
                _fixture.Context.Companies.AddRange(Seed.Companies());
                _fixture.Context.Users.AddRange(Seed.Users());
                _fixture.Context.Teams.AddRange(Seed.Teams());
                _fixture.Context.TeamMembers.AddRange(Seed.TeamMembers());
                _fixture.Context.SaveChanges();
            });

            _repository          = new Repository <Vacation>(_fixture.Context);
            _holidayRepository   = new Repository <Holiday>(_fixture.Context);
            _leaveTypeRepository = new Repository <LeaveType>(_fixture.Context);
            _unitOfWork          = new UnitOfWork(_fixture.Context);

            _handler = new CreateVacationHandler(unitOfWork: _unitOfWork,
                                                 repository: _repository,
                                                 holidayRepository: _holidayRepository,
                                                 leaveTypeRepository: _leaveTypeRepository,
                                                 logger: _logger,
                                                 mapper: _mapper);
        }
Exemplo n.º 2
0
        public DeleteTeamHandlerTest(VacationTrackingDbContextFixture fixture)
        {
            _fixture = fixture;
            _logger  = new NullLogger <DeleteTeamHandler>();

            //auto mapper configuration
            var mockMapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(typeof(Service.Mapper.AutoMapping));
            });

            _mapper = mockMapper.CreateMapper();


            _fixture.Initialize(true, () =>
            {
                _fixture.Context.Companies.AddRange(Seed.Companies());
                _fixture.Context.Users.AddRange(Seed.Users());
                _fixture.Context.SaveChanges();
            });
        }