public void GetCommentsFor_NullItem() { var manager = new Mod.CommentManager(); var entries = manager.GetCommentsFor(null, 10); Assert.That(entries, Is.Empty); }
public void GetCommentsFor_EntryWithComments_Sorted() { var blog = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1)); var commetLuna1 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 4)); var commetLuna2 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 6)); var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2)); var commentDeimos1 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 7)); var commentDeimos2 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 8)); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsFor(blog, 10, true); var ids = from comment in comments select comment.ID; Assert.That(ids, Is.EqualTo(new[] { commetLuna1.ID, commetLuna2.ID, commentDeimos1.ID, commentDeimos2.ID })); }
public void GetCommentsFor_EntryWithoutComments() { var blog = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1)); var commetLuna1 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 1)); var commetLuna2 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 3)); var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2)); var commentDeimos1 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 5)); var commentDeimos2 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 6)); var entryPhobos = TestUtil.CreateNewEntry(blog, "Phobos", entryDate: new DateTime(2012, 3, 3)); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsFor(entryPhobos, 10); Assert.That(comments, Is.Empty); }
public void GetCommentsFor_EntryWithComments_Sorted_Reverse() { var blog = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1)); var commetLuna1 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 2)); var commetLuna2 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 6)); var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2)); var commentDeimos1 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 7)); var commentDeimos2 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 8)); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsFor(blog, 10, true, true); var ids = from comment in comments select comment.ID; Assert.That(ids, Is.EqualTo(new[] { commentDeimos2.ID, commentDeimos1.ID, commetLuna2.ID, commetLuna1.ID })); }
public void GetCommentsFor_BlogItem() { var blog = TestUtil.CreateNewBlog(TestContentRoot); var entryLuna = TestUtil.CreateNewEntry(blog, "Luna", entryDate: new DateTime(2012, 3, 1)); var commetLuna1 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 1)); var commetLuna2 = TestUtil.CreateNewComment(entryLuna, new DateTime(2012, 3, 3)); var entryDeimos = TestUtil.CreateNewEntry(blog, "Deimos", entryDate: new DateTime(2012, 3, 2)); var commentDeimos1 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 5)); var commentDeimos2 = TestUtil.CreateNewComment(entryDeimos, new DateTime(2012, 3, 10)); TestUtil.UpdateIndex(); var manager = new Mod.CommentManager(); var comments = manager.GetCommentsFor(blog, 10); var ids = from comment in comments select comment.ID; Assert.That(ids, Is.EquivalentTo(new[] { commetLuna1.ID, commetLuna2.ID, commentDeimos1.ID, commentDeimos2.ID })); }