Ejemplo n.º 1
0
        public void NotValidDataException0_0( )
        {
            PayrollService.Server.PayrollService        payrollService        = new Server.PayrollService( );
            PayrollService.Models.PayrollServiceContext payrollServiceContext = new Models.PayrollServiceContext( );
            PayrollServiceController payrollServiceController = new PayrollServiceController(payrollService, payrollServiceContext);

            Utility.PayrollCalculateInput payrollCalculateInput = new Utility.PayrollCalculateInput( )
            {
                CountryCode = "DE",
                HourlyRate  = 0,
                HoursWorked = 0
            };
            Task <IHttpActionResult> iHttpActionResult = payrollServiceController.GetTaxRole(payrollCalculateInput);

            Assert.IsNotNull(iHttpActionResult.Result);
            PayrollResponse payrollResponse = ((System.Web.Http.Results.OkNegotiatedContentResult <PayrollService.Utility.PayrollResponse>)iHttpActionResult.Result).Content as PayrollResponse;

            Assert.AreEqual(payrollResponse.Message, "Data is not valid");
        }
Ejemplo n.º 2
0
        public void GetTaxRoleForSpainWithRate50_20( )
        {
            PayrollService.Server.PayrollService        payrollService        = new Server.PayrollService( );
            PayrollService.Models.PayrollServiceContext payrollServiceContext = new Models.PayrollServiceContext( );
            PayrollServiceController payrollServiceController = new PayrollServiceController(payrollService, payrollServiceContext);

            Utility.PayrollCalculateInput payrollCalculateInput = new Utility.PayrollCalculateInput( )
            {
                CountryCode = "SP",
                HourlyRate  = 20,
                HoursWorked = 50
            };
            Task <IHttpActionResult> iHttpActionResult = payrollServiceController.GetTaxRole(payrollCalculateInput);

            PayrollResponse payrollResponse = ((System.Web.Http.Results.OkNegotiatedContentResult <PayrollService.Utility.PayrollResponse>)iHttpActionResult.Result).Content as PayrollResponse;

            Assert.IsNotNull(payrollResponse);
            Assert.AreEqual(payrollResponse.Message, "true");
            Assert.AreEqual(payrollResponse.NetSalary, 650);
            Assert.AreEqual(payrollResponse.TaxesDeductions, 350);
            Assert.AreEqual(payrollResponse.GrossSalary, 1000);
        }