Ejemplo n.º 1
0
        public void Expense_Based_Values_Map_InCharge_Correctly()
        {
            // arrange
            const string userId = "9d3c8120a653cebbe040007f01002438";

            string expenseJson = @"{ ""data"": [{
                ""actualUnitAmount"": 4,
                ""effectiveDate"": ""2010-12-26"",
                ""DE:Expense Owner"": ""9d3c8120a653cebbe040007f01002438"",
                ""expenseTypeID"": ""9d3c90342fe3fa2ae040007f01002426""},
                {""actualUnitAmount"": 3,
                ""effectiveDate"": ""2010-12-26"",
                ""DE:Expense Owner"": ""9d3c8120a653cebbe040007f01002438"",
                ""expenseTypeID"": ""9d3c90342fe3fa2ae040007f01002426""},
                {""actualUnitAmount"": 9,
                ""effectiveDate"": ""2010-12-26"",
                ""DE:Expense Owner"": ""1337"",
                ""expenseTypeID"": ""9d3c90342fe3fa2ae040007f01002426""}]}";

            JArray expenses = JObject.Parse(expenseJson).Value<JArray>("data");
            JArray timesheets = CreateAggregatePayrollJson();
            PayrollMapper mapper = new PayrollMapper();

            // act
            Payroll[] payrollItems = mapper.MapAggregateJsonToPayroll(timesheets, expenses);

            // assert
            Payroll payroll = payrollItems.Single(x => x.EmployeeID == userId);
            Assert.AreEqual(7, payroll.InChargeDays);
        }
Ejemplo n.º 2
0
        public void PayrollMapper_Can_Calculate_Mileage_With_Multiple_Expense_Owners()
        {
            // arrange
            var mapper = new PayrollMapper();

            // act
            var payrollItems = mapper.MapAggregateJsonToPayroll(CreateAggregatePayrollForMultipleOwnerJson(), CreateExpensesWithMultipleOwnerJson());

            // assert
            var payroll = payrollItems.Single(x => x.EmployeeID == "9d3c8120a611cebbe040007f01002438");
            Assert.AreEqual(340.0, payroll.TotalMileage);
        }
Ejemplo n.º 3
0
        public void PTO_Value_Is_Mapped_To_Payroll()
        {
            // arrange
            const string UserID = "9d3c8120a614cebbe040007f01002438";
            JArray timesheets = CreateAggregatePayrollJson();
            PayrollMapper mapper = new PayrollMapper();

            // act
            Payroll[] payrollItems = mapper.MapAggregateJsonToPayroll(timesheets);

            // assert
            var item = payrollItems.Single(x => x.EmployeeID == UserID);
            Assert.AreEqual(32, item.PaidTimeOff);
        }