public async void DeleteConfirmed_ReturnNotFound(int serviceID) { var controller = new ServicesController(Context, UserManager); controller.ControllerContext.HttpContext = new DefaultHttpContext { User = PrestadorLog }; var result = await controller.DeleteConfirmed(serviceID); var viewResult = Assert.IsType <ViewResult>(result); Assert.Equal("/Views/Shared/NotFound.cshtml", viewResult.ViewName); }
public async void DeleteConfirmed_ReturnRedirect() { var size = Context.Service.Count(); var controller = new ServicesController(Context, UserManager); controller.ControllerContext.HttpContext = new DefaultHttpContext { User = PrestadorLog }; var result = await controller.DeleteConfirmed(5); Assert.IsType <RedirectToActionResult>(result); //Confirmar Index var resultIndex = await controller.UserServices(1); var viewResultIndex = Assert.IsType <ViewResult>(resultIndex); var modelIndex = Assert.IsAssignableFrom <IEnumerable <Service> >(viewResultIndex.ViewData.Model); Assert.NotNull(modelIndex); Assert.Equal(size - 1, modelIndex.Count()); }