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);
        }
示例#2
0
        public void On_GetBreaks_Ingores_From_IgnoreList()
        {
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);
            var data       = new AlohaDataset();
            var adjtimeRow = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 12, 30, 0.5m, 10m, 10m);

            data.adjtime.AddadjtimeRow(adjtimeRow);
            var ignoreList = new List <int> {
                1
            };

            List <Transaction> result = subject.GetBreaks(data, ignoreList);

            result.Should().BeEmpty();
        }
示例#3
0
        public void On_GetShifts_Get_TransactionEnumerable()
        {
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);
            var data       = new AlohaDataset();
            var adjtimeRow = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 12, 30, 0.5m, 10m, 10m);

            data.adjtime.AddadjtimeRow(adjtimeRow);
            var ignoreList = new List <int> {
                10
            };

            List <Transaction> result = subject.GetShifts(data, ignoreList);

            result.Should().NotBeNull();
            result.Should().NotBeEmpty();
            result.Should().Contain(c => c.EmpId == 1);
        }
示例#4
0
        public void On_ConvertShiftRow_GetRightShift()
        {
            var data       = new AlohaDataset();
            var adjtimeRow = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 12, 30, 0.5m, 10m, 10m);
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);

            var result = subject.ConvertShiftRow(adjtimeRow);

            result.Type.Should().Be(TransactionType.ClockInOut);
            result.PeriodType.Should().Be(PeriodType.Shift);
            result.PayCode.Should().Be(string.Empty);
            result.EmpId.Should().Be(adjtimeRow.employee);
            result.SSN.Should().Be(adjtimeRow.ssn);
            result.JobCode.Should().Be(adjtimeRow.jobcode);
            result.ClockIn.Should().Be(DateTime.Today.AddHours(12));
            result.ClockOut.Should().Be(DateTime.Today.AddHours(12).AddMinutes(30));
            result.Hours.Should().BeApproximately(0.5m, 0.001m);
        }
示例#5
0
        public void On_GetShifts_Gets_All_Transactions()
        {
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);
            var data        = new AlohaDataset();
            var adjtimeRow  = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 12, 30, 0.5m, 10m, 10m);
            var adjtimeRow2 = AlohaDataUtils.CreateAdjTimeRow(data, 2, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 1, 0, 1, 30, 0.5m, 10m, 10m);

            data.adjtime.AddadjtimeRow(adjtimeRow);
            data.adjtime.AddadjtimeRow(adjtimeRow2);
            var ignoreList = new List <int> {
                10
            };

            var result = subject.GetShifts(data, ignoreList);

            result.Count().Should().Be(data.adjtime.Count());
            result.Should().Contain(t => t.EmpId == 1);
            result.Should().Contain(t => t.EmpId == 2);
        }
        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);
        }
示例#7
0
        public void On_ConvertTipRow_GetRightTip_Using_Strategy_Auto()
        {
            var data        = new AlohaDataset();
            var adjtimeRow  = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 12, 30, 0.5m, 1m, 2m);
            var adjtimeRow2 = AlohaDataUtils.CreateAdjTimeRow(data, 1, "", DateTime.Today, DateTime.Today, DateTime.Today, 1, 12, 0, 12, 30, 0.5m, 2m, 1m);
            IPayrollConverterUtils subject = new PayrollConverterUtils(logger);
            var tipstrategy = TipCalculation.Auto;

            var result  = subject.ConvertTipRow(adjtimeRow, tipstrategy);
            var result2 = subject.ConvertTipRow(adjtimeRow2, tipstrategy);

            result.Type.Should().Be(TransactionType.PayCode);
            result.PeriodType.Should().Be(PeriodType.Unknown);
            result.PayCode.Should().Be("T");
            result.EmpId.Should().Be(adjtimeRow.employee);
            result.SSN.Should().Be(adjtimeRow.ssn);
            result.JobCode.Should().Be(adjtimeRow.jobcode);
            result.ClockIn.Should().Be(DateTime.Today.AddHours(12));
            result.ClockOut.Should().Be(DateTime.MinValue);
            result.Hours.Should().BeApproximately(0m, 0.001m);
            result.Tips.Should().BeApproximately(2m, 0.001m);
            result2.Tips.Should().BeApproximately(2m, 0.001m);
        }