public void ServicesReturnsIndexView() { //Arrage //Act var result = _servicesControllerUnderTest.Index() as ViewResult; //Assert Assert.IsNotNull(result); }
public async void Index_ReturnViewResult(string order) { var controller = new ServicesController(Context, UserManager); controller.ControllerContext.HttpContext = new DefaultHttpContext { User = ClientLog }; var result = await controller.Index(order, 1); var viewResult = Assert.IsType <ViewResult>(result); var model = Assert.IsAssignableFrom <IEnumerable <Service> >(viewResult.ViewData.Model); Assert.NotNull(model); Assert.Equal(Context.Service.Count(), model.Count()); }