public async Task ShouldDeleteOneEmployeeDepartmentHistoryRecord()
        {
            int      employeeID  = 1;
            short    deptID      = 10;
            byte     shiftID     = 3;
            DateTime startDate   = new DateTime(2009, 1, 14);
            var      deptHistory = await _deptHistoryRepo.GetDepartmentHistoryByID(employeeID, deptID, shiftID, startDate);

            await _deptHistoryRepo.DeleteDepartmentHistory(deptHistory);

            var result = await _deptHistoryRepo.GetDepartmentHistoryByID(employeeID, deptID, shiftID, startDate);

            Assert.Null(result);
        }
Exemple #2
0
        public async Task ShouldUpdateEmployeeDepartmentHistoryRecord()
        {
            int      employeeID  = 1;
            short    deptID      = 10;
            byte     shiftID     = 3;
            DateTime startDate   = new DateTime(2009, 1, 14);
            var      deptHistory = await _deptHistoryRepo.GetDepartmentHistoryByID(employeeID, deptID, shiftID, startDate);

            var endDate = new DateTime(2019, 1, 1);

            deptHistory.EndDate = endDate;

            await _deptHistoryRepo.UpdateDepartmentHistory(deptHistory);

            var result = await _deptHistoryRepo.GetDepartmentHistoryByID(employeeID, deptID, shiftID, startDate);

            Assert.Equal(endDate, result.EndDate);
        }
        public async Task ShouldCreateEmployeeDepartmentHistoryRecord()
        {
            var deptHistory = new EmployeeDepartmentHistory
            {
                BusinessEntityID = 14,
                DepartmentID     = 10,
                ShiftID          = 3,
                StartDate        = new DateTime(2020, 8, 18)
            };

            await _deptHistoryRepo.CreateDepartmentHistory(deptHistory);

            var result = await _deptHistoryRepo.GetDepartmentHistoryByID(deptHistory.BusinessEntityID, deptHistory.DepartmentID, deptHistory.ShiftID, deptHistory.StartDate);

            Assert.Equal(result.StartDate, new DateTime(2020, 8, 18));
        }
        public void ShouldRetrieveEachDeptHistoryRecord(int employeeID, short deptID, byte shiftID, string startDate)
        {
            var deptHistory = _deptHistoryRepo.GetDepartmentHistoryByID(employeeID, deptID, shiftID, DateTime.Parse(startDate));

            Assert.NotNull(deptHistory);
        }