public void SetsViewDataWithProcurementModel() { var controller = new ProcurementController(ProcurementFactory); const int parameter = 1; var result = controller.Details(parameter); var viewResult = Assert.IsType<ViewResult>(result); Assert.IsType<Procurement>(viewResult.ViewData.Model); }
public void ReturnsViewResultWithDefaultViewName() { var controller = new ProcurementController(ProcurementFactory); const int parameter = 1; var result = controller.Details(parameter); var viewResult = Assert.IsType<ViewResult>(result); Assert.Empty(viewResult.ViewName); }
public void RedirectsToHomeWhenNoIdIsPassed() { var controller = new ProcurementController(ProcurementFactory); int? parameter = null; var result = controller.Details(parameter); var viewResult = Assert.IsType<RedirectToRouteResult>(result); Assert.Equal("Home", viewResult.RouteValues["controller"]); Assert.Equal("Index", viewResult.RouteValues["action"]); }