public void On_Convert_Payroll_MultipleShift_FixesTips()
        {
            IPayrollConverterUtils payrollConverterUtils = new PayrollConverterUtils(logger);
            var employeeRepository    = new EmployeeRepositoryService(logger);
            IPayrollConverter subject = new PayrollConverter(logger, payrollConverterUtils, employeeRepository);
            var data         = new AlohaDataset();
            var empRow       = AlohaDataUtils.CreateEmpRow(data, 1, "123456789", "Test", "Employee", 123456789);
            var adjtimeRow   = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 14, 30, 0.5m, 10m, 10m);
            var adjtimeRow2  = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 15, 0, 16, 30, 0.5m, 10m, 10m);
            var gndbroeakRow = AlohaDataUtils.CreateBreakRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 30, 13, 00, 0.5m);

            data.emp.AddempRow(empRow);
            data.adjtime.AddadjtimeRow(adjtimeRow);
            data.adjtime.AddadjtimeRow(adjtimeRow2);
            data.gndbreak.AddgndbreakRow(gndbroeakRow);
            var tipStrategy = TipCalculation.Auto;

            var result = subject.ConvertPayroll(data, tipStrategy);

            var resultTips = result[0].Transactions.Where(t => t.Type == TransactionType.PayCode).ToList();

            resultTips.Count.Should().Be(2);
            resultTips[0].ClockIn.Hour.Should().Be(12);
            resultTips[0].ClockIn.Minute.Should().Be(0);
            resultTips[1].ClockIn.Hour.Should().Be(12);
            resultTips[1].ClockIn.Minute.Should().Be(5);
        }
Beispiel #2
0
        public void On_ConvertEmployeeRow_GetRightEmployee()
        {
            var data   = new AlohaDataset();
            var empRow = AlohaDataUtils.CreateEmpRow(data, 1, "123456789", "Test", "Employee", 123456789);
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);

            var result = subject.ConverEmployeeRow(empRow);

            result.ID.Should().Be(empRow.id);
            result.SocialSecurity.Should().Be(empRow.ssn);
            result.FirstName.Should().Be(empRow.firstname);
            result.LastName.Should().Be(empRow.lastname);
            result.Transactions.Should().BeEmpty();
        }
Beispiel #3
0
        public void On_GetEmployees_Gets_EmployeeEnumerable()
        {
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);
            var data   = new AlohaDataset();
            var empRow = AlohaDataUtils.CreateEmpRow(data, 1, "123456789", "Test", "Employee", 123456789);

            data.emp.AddempRow(empRow);

            List <Employee> result = subject.GetEmployees(data);

            result.Should().NotBeNull();
            result.Should().NotBeEmpty();
            result.Should().Contain(c => c.ID == 1);
        }
Beispiel #4
0
        public void On_GetEmployees_Gets_All_Employees()
        {
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);
            var data    = new AlohaDataset();
            var empRow  = AlohaDataUtils.CreateEmpRow(data, 1, "123456789", "Test", "Employee1", 123456789);
            var empRow2 = AlohaDataUtils.CreateEmpRow(data, 2, "987654321", "Test", "Employee2", 987654321);

            data.emp.AddempRow(empRow);
            data.emp.AddempRow(empRow2);

            var result = subject.GetEmployees(data);

            result.Count().Should().Be(data.emp.Count());
            result.Should().Contain(e => e.ID == 1);
            result.Should().Contain(e => e.ID == 2);
        }
        public void On_Convert_Payroll_OnlyEmployees_ReturnsListWith_EmptyTransactions()
        {
            IPayrollConverterUtils payrollConverterUtils = new PayrollConverterUtils(logger);
            var employeeRepository    = new EmployeeRepositoryService(logger);
            IPayrollConverter subject = new PayrollConverter(logger, payrollConverterUtils, employeeRepository);
            var data   = new AlohaDataset();
            var empRow = AlohaDataUtils.CreateEmpRow(data, 1, "123456789", "Test", "Employee", 123456789);

            data.emp.AddempRow(empRow);
            var tipStrategy = TipCalculation.Auto;

            var result = subject.ConvertPayroll(data, tipStrategy);

            result.Should().NotBeNull();
            result.Count.Should().Be(1);
            result[0].Transactions.Count.Should().Be(0);
        }
        public void On_Convert_Payroll_EmpFullData_ReturnsListWith_Transactions()
        {
            IPayrollConverterUtils payrollConverterUtils = new PayrollConverterUtils(logger);
            var employeeRepository    = new EmployeeRepositoryService(logger);
            IPayrollConverter subject = new PayrollConverter(logger, payrollConverterUtils, employeeRepository);
            var data         = new AlohaDataset();
            var empRow       = AlohaDataUtils.CreateEmpRow(data, 1, "123456789", "Test", "Employee", 123456789);
            var adjtimeRow   = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 14, 30, 0.5m, 10m, 10m);
            var gndbroeakRow = AlohaDataUtils.CreateBreakRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 30, 13, 00, 0.5m);

            data.emp.AddempRow(empRow);
            data.adjtime.AddadjtimeRow(adjtimeRow);
            data.gndbreak.AddgndbreakRow(gndbroeakRow);
            var tipStrategy = TipCalculation.Auto;

            var result = subject.ConvertPayroll(data, tipStrategy);

            result[0].Transactions.Count.Should().Be(3);
            result[0].Transactions.Should().Contain(t => t.Type == TransactionType.ClockInOut && t.PeriodType == PeriodType.Shift);
            result[0].Transactions.Should().Contain(t => t.Type == TransactionType.ClockInOut && t.PeriodType == PeriodType.Break);
            result[0].Transactions.Should().ContainSingle(t => t.Type == TransactionType.PayCode);
        }