コード例 #1
0
        public void SortIsDescending_ByAct_ReturnsHomeView()
        {
            var accessor   = TestHelperLibrary.SetUpHttpContextAccessor();
            var unitOfWork = TestHelperLibrary.SetupUnitOfWork();

            accessor.Object.HttpContext.Session.SetInt32("page_size", 3);
            var controller = new VacationController(unitOfWork.Object, accessor.Object);

            controller.Sort(SortType.SortByActivities);
            controller.Sort(SortType.SortByActivities);

            var result    = controller.Home() as ViewResult;
            var viewModel = result.Model as VacationListViewModel;

            Assert.Equal(3, viewModel.Trips[2].Id);
            Assert.Equal(2, viewModel.Trips[1].Id);
            Assert.Equal(1, viewModel.Trips[0].Id);
            Assert.IsType <ViewResult>(result);
        }