public void GetBlogComments_NullItem_ReturnsEmptyList() { var manager = new Mod.CommentManager(null, null, null, null); var comments = manager.GetBlogComments(null, 10); Assert.That(comments, Is.Empty); }
public void GetBlogComments_NoComments_ReturnsEmptyList() { 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(null, null, null, null); var comments = manager.GetBlogComments(blog, 10); Assert.That(comments, Is.Empty); }
public void GetBlogComments_Limited_ReturnsStartOfList() { 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(null, null, null, null); var comments = manager.GetBlogComments(blog, 3); var ids = from comment in comments select comment.Uri.ItemID; Assert.That(ids, Is.EqualTo(new[] { deimosComment2.ID, deimosComment1.ID, lunaComment2.ID })); }
public void GetBlogComments_CommentsInOtherBlog_ReturnsEmptyList() { 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(null, null, null, null); var comments = manager.GetBlogComments(blog2, 3); Assert.That(comments, Is.Empty); }
public void GetBlogComments_CommentsInManyBlogs_ReturnsCommentsInTargetBlog() { 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(null, null, null, null); var comments = manager.GetBlogComments(blog1, 3); var ids = from comment in comments select comment.Uri.ItemID; Assert.That(ids, Is.EqualTo(new[] { lunaComment1.ID })); }