public void List_FirstPage_IsDisplayed()
        {
            //Arrange
            var postRepository = new MockPostService().Service;
            var postCategoryRepository = new MockPostCategoryDataService().DataService;
            var controller = new PostsController( postRepository, null, null, null, null, null, null, null, null );

            //Act
            var result = controller.Index( string.Empty, null, null, null, null );

            // Assert
            Assert.IsNotNull(result);
        }
        public void List_Number_Of_Items_Displayed_On_Page_Equals_DefaultPageSize()
        {
            //Arrange
            var postRepository = new MockPostService().Service;
            var postCategoryRepository = new MockPostCategoryDataService().DataService;
            var locationService = new MockLocationService().Service;
            var controller = new PostsController( postRepository, locationService, null, null, null, null, null, null, null );

            //Act
            var result = controller.Index( string.Empty, null, null, null, null );
            var model = ((ViewResult)result).ViewData.Model as DefaultViewModel<Post>;
            
            // Assert
            Assert.IsNotNull( model.PagedList );
            //Assert.AreEqual( 15, model.PagedList.Count, "Wrong number of posts" );
        }
        public void List_Presents_Correct_Page_Of_Posts()
        {
            //Arrange
            var postRepository = new MockPostService().Service;
            var postCategoryRepository = new MockPostCategoryDataService().DataService;
            var controller = new PostsController( postRepository, null, null, null, null, null, null, null, null );
            //controller.PageSize = 3;

            //Act
            var result = controller.Index( string.Empty, null, null, null, null );
            var model = ((ViewResult)result).ViewData.Model as DefaultViewModel<Post>;

            //Assert
            Assert.IsNotNull( model.PagedList );
            Assert.AreEqual( "Wanted: Socks", model.PagedList.ElementAt<Post>( 0 ).Title );
            Assert.AreEqual( "Offered: Linen", model.PagedList.ElementAt<Post>( 1 ).Title );
        }