public void BlogControllerUpdate() { var result = _ctrl.Update(new BlogEngine.Core.Data.Models.Blog() { Id = Guid.NewGuid() }); Assert.AreEqual(HttpStatusCode.OK, result.StatusCode); }
public void UpdateBlogModifiesBlogsList() { var userID = "dd"; Blog sampleBlog = new Blog(userID, "blog1", "description"); var result = controller.Create(sampleBlog); sampleBlog = ((result as ObjectResult).Value as Blog); sampleBlog.Name = "blog2"; controller.Update(sampleBlog, sampleBlog.ID); var blogs = controller.GetUserBlogs(userID).Value; var oldBlog = blogs.FirstOrDefault(b => b.Name == "blog1"); Assert.Null(oldBlog); sampleBlog = controller.GetBlog(sampleBlog.ID).Value; Assert.Equal(sampleBlog.Name, "blog2"); }