public void PagingGet() { CommentsController controller = new CommentsController(new InitialData()); List<Comment> comments = new List<Comment>(controller.GetComments()); int pageIndex = 1; int pageSize = 2; List<Comment> commentsPage = new List<Comment>(controller.GetComments(pageIndex, pageSize)); Assert.AreEqual(2, commentsPage.Count); for (int i = 0; i < commentsPage.Count; i++) { Assert.AreEqual(comments[pageIndex * pageSize + i].ID, commentsPage[i].ID); } }
public void GetComments() { CommentsController controller = new CommentsController(new InitialData()); IEnumerable<Comment> comments = controller.GetComments(); Assert.IsNotNull(comments); Assert.IsTrue(comments.Count() > 0); }