public void IndexAction_WhenInvoking_CanPaginate()
 {
     var controller = new UserController(mock.Object);
     var result = ((UsersListViewModel)controller.Index(2, 3).Model).Users;
     Assert.IsTrue(result.Length == 3);
     Assert.AreEqual("Madison", result[0].LastName);
     Assert.AreEqual("Monroe", result[1].LastName);
     Assert.AreEqual("Quincy Adams", result[2].LastName);
 }
        public void IndexAction_WhenInvoking_ReturnsFirstPageOfUsers()
        {
            var controller = new UserController(mock.Object);

            var usersResult = ((UsersListViewModel)controller.Index().ViewData.Model).Users;

            Assert.AreEqual(5, usersResult.Length);
            Assert.AreEqual("George", usersResult[0].FirstName);
            Assert.AreEqual("John", usersResult[1].FirstName);
            Assert.AreEqual("Thomas", usersResult[2].FirstName);
            Assert.AreEqual("James", usersResult[3].FirstName);
            Assert.AreEqual("James", usersResult[4].FirstName);
        }
        public void IndexAction_WhenInvoking_ReturnViewModel()
        {
            var controller = new UserController(mock.Object);

            var viewModel = (UsersListViewModel)controller.Index(2, 2).Model;

            var pagerData = viewModel.PagerData;
            Assert.AreEqual(2, pagerData.PageNumber);
            Assert.AreEqual(2, pagerData.PageSize);
            Assert.AreEqual(6, pagerData.UsersCount);
            Assert.AreEqual(3, pagerData.PagesCount);
        }