public void verify_calculation_and_redirect_onpost() { // Arrange var httpContext = new DefaultHttpContext(); var modelState = new ModelStateDictionary(); var actionContext = new ActionContext(httpContext, new RouteData(), new PageActionDescriptor(), modelState); var modelMetadataProvider = new EmptyModelMetadataProvider(); var viewData = new ViewDataDictionary(modelMetadataProvider, modelState); var tempData = new TempDataDictionary(httpContext, A.Fake <ITempDataProvider>()); var pageContext = new PageContext(actionContext) { ViewData = viewData }; IDeductionCalculationService deductionCalculationService = A.Fake <IDeductionCalculationService>(); var objectUnderTest = new EmployeeInformationModel(deductionCalculationService) { PageContext = pageContext, TempData = tempData, Url = new UrlHelper(actionContext) }; // Act var result = objectUnderTest.OnPost(); // Assert Assert.IsInstanceOfType(result, typeof(RedirectToPageResult)); Assert.IsTrue(((RedirectToPageResult)result).PageName == Paylocity.CodingChallenge.Web.Code.Constants.RESULTS_PAGE); A.CallTo(() => deductionCalculationService.CalculateDeductions(A <Employee> ._)).MustHaveHappened(); }
public BenefitsCalculatorController(IDeductionCalculationService deductionCalculationService) { _deductionCalculationService = deductionCalculationService; }
public EmployeeInformationModel(IDeductionCalculationService deductionCalculationService) { _deductionCalculationService = deductionCalculationService; PopulateDependentTypeList(); }