public void ConfirmDeleteAction_IdFound_ReturnsViewByConvention() { var movie = _documentSession.SaveNewMovieToRavenDB(new Movie().NewValid()); var homeController = new HomeController(_documentSession); var result = (ViewResult)homeController.ConfirmDelete(movie.Id); Assert.That(result.ViewName, Is.Empty); }
public void CreateAction_FailsModelValidation_ReturnsViewByConvention() { var homeController = new HomeController(_documentSession); homeController.ModelState.AddModelError("Title", "The Title field is required."); var result = (ViewResult)homeController.Create(new Movie().NewInvalid()); Assert.That(result.ViewName, Is.Empty); }
public void ConfirmDeleteAction_IdFound_ViewModelIsMovie() { var movie = _documentSession.SaveNewMovieToRavenDB(new Movie().NewValid()); var homeController = new HomeController(_documentSession); var result = (ViewResult)homeController.ConfirmDelete(movie.Id); Assert.IsInstanceOf<Movie>(result.Model); }
public void CreateAction_PassesModelValidation_RedirectsToIndexActionSettingMessage() { var movie = new Movie().NewValid(); var homeController = new HomeController(_documentSession); homeController.Create(movie); Assert.That(homeController.TempData["message"], Is.EqualTo(string.Format("Created Movie {0}", movie.Title))); }
public void CreateAction_PassesModelValidation_RedirectsToIndexAction() { var homeController = new HomeController(_documentSession); var result = (RedirectToRouteResult)homeController.Create(new Movie().NewValid()); Assert.That(result.RouteValues["action"], Is.EqualTo("Index")); }
public void CreateAction_Always_ReturnsViewByConvention() { var homeController = new HomeController(_documentSession); var result = (ViewResult)homeController.Create(); Assert.That(result.ViewName, Is.Empty); }
public void ConfirmDeleteAction_IdNotFound_RedirectsToIndexActionSettingMessage() { var homeController = new HomeController(_documentSession); homeController.ConfirmDelete(0); Assert.That(homeController.TempData["Message"], Is.EqualTo(string.Format("Movie {0} not found", 0))); }
public void ConfirmDeleteAction_IdNotFound_RedirectsToIndexAction() { var homeController = new HomeController(_documentSession); var result = (RedirectToRouteResult)homeController.ConfirmDelete(0); Assert.That(result.RouteValues["action"], Is.EqualTo("Index")); }
public void ListAction_SuppliedNullMessage_MessageIsAddedToViewBagNoErrorIsThrown() { var homeController = new HomeController(_documentSession); var result = (ViewResult)homeController.List(null); Assert.That((string)result.ViewBag.Message, Is.Null); }
public void ListAction_Always_ViewModelIsAListOfMovies() { var homeController = new HomeController(_documentSession); var result = (ViewResult)homeController.List(null); Assert.IsInstanceOf<List<Movie>>(result.Model); }
public void EditAction_PassesModelValidation_RedirectsToIndexActionSettingMessage() { var movie = _documentSession.SaveNewMovieToRavenDB(new Movie().NewValid()); var homeController = new HomeController(_documentSession); homeController.Edit(movie); Assert.That(homeController.TempData["message"], Is.EqualTo(string.Format("Saved changes to Movie {0}", movie.Title))); }
public void DeleteAction_Always_RedirectsToIndexActionSettingMessage() { var movie = _documentSession.SaveNewMovieToRavenDB(new Movie().NewValid()); var homeController = new HomeController(_documentSession); homeController.Delete(movie.Id); Assert.That(homeController.TempData["message"], Is.EqualTo(string.Format("Deleted Movie with the Id {0}", movie.Id))); }
public void DeleteAction_Always_RedirectsToIndexAction() { var movie = _documentSession.SaveNewMovieToRavenDB(new Movie().NewValid()); var homeController = new HomeController(_documentSession); var result = (RedirectToRouteResult)homeController.Delete(movie.Id); Assert.That(result.RouteValues["action"], Is.EqualTo("Index")); }