public void GetCommentsByBlog_NullItem() { var manager = new Mod.CommentManager(); var comments = manager.GetCommentsByBlog(null, 10); Assert.That(comments, Is.Empty); }
public void GetCommentsByBlog_NoComments() { var blog = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1)); var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2)); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsByBlog(blog, 10); Assert.That(comments, Is.Empty); }
public void GetCommentsByBlog_CommentsInBlog_Limited() { var blog = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1)); var lunaComment1 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 1)); var lunaComment2 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 2)); var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2)); var deimosComment1 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 3)); var deimosComment2 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 4)); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsByBlog(blog, 3); var ids = from comment in comments select comment.ID; Assert.That(ids, Is.EqualTo(new[] { deimosComment2.ID, deimosComment1.ID, lunaComment2.ID })); }
public void GetCommentsByBlog_CommentsInOtherBlog() { var blog1 = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog1, "Luna", entryDate: new DateTime(2012, 3, 1)); var lunaComment1 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 1)); var lunaComment2 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 2)); var entryDeimos = TestUtil.CreateNewEntry(blog1, "Deimos", entryDate: new DateTime(2012, 3, 2)); var deimosComment1 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 3)); var deimosComment2 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 10)); var blog2 = TestUtil.CreateNewBlog(TestContentRoot); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsByBlog(blog2, 3); Assert.That(comments, Is.Empty); }
public void GetCommentsByBlog_CommentsInManyBlogs() { var blog1 = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog1, "Luna", entryDate: new DateTime(2012, 3, 1)); var lunaComment1 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 1)); var entryDeimos = TestUtil.CreateNewEntry(blog1, "Deimos", entryDate: new DateTime(2012, 3, 2)); var blog2 = TestUtil.CreateNewBlog(TestContentRoot); var entryAlpha = TestUtil.CreateNewEntry(blog2, "alpha", entryDate: new DateTime(2012, 3, 1)); TestUtil.CreateNewComment(entryAlpha, new DateTime(2012, 3, 2)); TestUtil.CreateNewComment(entryAlpha, new DateTime(2012, 3, 3)); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsByBlog(blog1, 3); var ids = from comment in comments select comment.ID; Assert.That(ids, Is.EqualTo(new[] { lunaComment1.ID })); }