public void TestNullReturn() { BlogPostContext ctx = newContext(); BlogPostCtxWrapper wrapper = new BlogPostCtxWrapper(ctx); BlogController bpc = new BlogController(wrapper); var obj = bpc.Get(2); Assert.Null(obj.Value); }
public void TestSimpleReturn() { BlogPostContext ctx = newContext(); BlogPostCtxWrapper wrapper = new BlogPostCtxWrapper(ctx); BlogController bpc = new BlogController(wrapper); var obj = bpc.Get(1); Assert.Equal("Help", obj.Value.Title); Assert.Equal(1, obj.Value.Version); }
public void testBlogPostCreate() { var ctx = newContext(); BlogPostCtxWrapper wrapper = new BlogPostCtxWrapper(ctx); var writterpost = wrapper.createBlogPost(new DBBlogPost() { Title = "Whatto", Date = DateTime.Now, File = "johnboy", Status = true, Version = 0 }); Assert.Equal(1, writterpost.Id); }
public void testUpdate() { var ctx = newContext(); var wrapper = new BlogPostCtxWrapper(ctx); var oldblog = wrapper.getBlogPost(1); // copied because oldblog is written over by the update function, unfortunately. var updblog = new DBBlogPost() { Id = oldblog.Id, Title = "Flimsey Fool", Date = DateTime.Now, File = oldblog.File, Status = oldblog.Status, Version = oldblog.Version }; wrapper.updateBlogPost(updblog); var newblog = wrapper.getBlogPost(1); Assert.Equal(oldblog.Id, newblog.Id); Assert.NotEqual(oldblog.Version, newblog.Version); }