Пример #1
0
        public void On_AdjustPaycodesForMultipleShifts_PayCodeTransactionsAreFixed()
        {
            int    id1       = 1;
            string ssn1      = "1";
            var    employee1 = new Employee {
                ID = id1, SocialSecurity = ssn1
            };
            var employees = new List <Employee> {
                employee1
            };
            IEmployeeRepositoryService subject = new EmployeeRepositoryService(logger);

            subject.LoadEmployees(employees);
            var transaction1 = new Transaction {
                EmpId = id1, Type = TransactionType.ClockInOut, ClockIn = DateTime.Today.AddHours(12)
            };
            var transaction2 = new Transaction {
                EmpId = id1, Type = TransactionType.PayCode, ClockIn = DateTime.Today.AddHours(12)
            };
            var transaction3 = new Transaction {
                EmpId = id1, Type = TransactionType.PayCode, ClockIn = DateTime.Today.AddHours(12)
            };
            var transactions = new List <Transaction> {
                transaction1, transaction2, transaction3
            };

            subject.LoadTransactions(transactions);

            subject.AdjustPaycodesForMultipleShifts();

            transaction1.ClockIn.Hour.Should().Be(12);
            transaction1.ClockIn.Minute.Should().Be(0);
            transaction2.ClockIn.Hour.Should().Be(12);
            transaction2.ClockIn.Minute.Should().Be(0);
            transaction3.ClockIn.Hour.Should().Be(12);
            transaction3.ClockIn.Minute.Should().Be(5);
        }