コード例 #1
0
        public void Setup()
        {
            InitializeMocks();
            DbContextMock.ShouldThrowException = false;

            _person = new Person
            {
                Id = 1
            };
            _dbContext.People.Add(_person);

            _otherPayment1 = new OtherPayment
            {
                Id        = 1,
                Value     = 123.45,
                Comment   = "Test",
                CreatedOn = _dateTimeUtil.GetCurrentDateTime(),
                PersonId  = _person.Id
            };

            _otherPayment2 = new OtherPayment
            {
                Id        = 1,
                Value     = 123.45,
                Comment   = "Test",
                CreatedOn = _dateTimeUtil.GetCurrentDateTime().AddMonths(1),
                PersonId  = _person.Id
            };
            _dbContext.OtherPayments.Add(_otherPayment1);
            _dbContext.OtherPayments.Add(_otherPayment2);

            _otherPaymentsRepository = new DAL.Repositories.OtherPaymentsRepository(_dbContext, _dateTimeUtil);
        }
コード例 #2
0
        public void Setup()
        {
            InitializeMocks();
            InitializeLoggerMock(new SalaryService(null, null, null, null, null, null, null, null));

            _position1 = new Position
            {
                Id       = 1,
                HourRate = 10,
                Name     = "Test"
            };

            _dbContext.Positions.Add(_position1);

            _staff1 = new Staff
            {
                Id         = 1,
                CreatedOn  = _dateTimeUtil.GetCurrentDateTime(),
                PositionId = _position1.Id,
                PersonId   = 1,
                ManagerId  = 1
            };

            _dbContext.Staff.Add(_staff1);

            _positionsRepository             = new DAL.Repositories.PositionsRepository(_dbContext, _dateTimeUtil);
            _staffRepository                 = new DAL.Repositories.StaffRepository(_dbContext, _dateTimeUtil);
            _dayOffRepository                = new DAL.Repositories.DayOffRepository(_dbContext, _dateTimeUtil);
            _holidaysRepository              = new DAL.Repositories.HolidaysRepository(_dbContext, _dateTimeUtil);
            _motivationModificatorRepository = new DAL.Repositories.MotivationModificatorRepository(_dbContext, _dateTimeUtil);
            _otherPaymentsRepository         = new DAL.Repositories.OtherPaymentsRepository(_dbContext, _dateTimeUtil);

            _salaryService = new SalaryService(_logger,
                                               _staffRepository,
                                               _dayOffRepository,
                                               _holidaysRepository,
                                               _positionsRepository,
                                               _motivationModificatorRepository,
                                               _otherPaymentsRepository,
                                               _dateTimeUtil);
        }