public void Smoke()
        {
            //arrange
            var blogRepositoryMock = CreateRepositoryMock();
            var controller = new PostsController(blogRepositoryMock.Object);

            //act / assert
            Assert.That(controller, Is.Not.Null);
        }
        public void GetIndexPageSizeIsFive()
        {
            //arrange
            var blogRepositoryMock = CreateRepositoryMock();
            var controller = new PostsController(blogRepositoryMock.Object);

            //act
            var result = controller.Index() as ViewResult;

            //assert
            var model = result.ViewData.Model as BlogPosts;
            Assert.That(model.Content.Count, Is.EqualTo(5));
        }
        public void GetIndexReturnBlogPage()
        {
            //arrange
            var blogRepositoryMock = CreateRepositoryMock();
            var controller = new PostsController(blogRepositoryMock.Object);

            //act
            var result = controller.Index() as ViewResult;

            //assert
            var model = result.ViewData.Model as BlogPosts;
            Assert.That(model, Is.Not.Null);
        }
        public void GetPostByUrl_ReturnsBlogPost()
        {
            //arrange
            var blogRepositoryMock = CreateRepositoryMock(10);
            var controller = new PostsController(blogRepositoryMock.Object);

            //act
            var result = controller.PostByUrl("Url-0") as ViewResult;

            //assert
            var model = result.ViewData.Model as BlogPost;
            Assert.That(model, Is.Not.Null);
        }
        public void GetPages_Third_ReturnsZeroPosts()
        {
            //arrange
            var blogRepositoryMock = CreateRepositoryMock(10);
            var controller = new PostsController(blogRepositoryMock.Object);

            //act
            var result = controller.Page(3) as ViewResult;

            //assert
            var model = result.ViewData.Model as BlogPosts;
            Assert.That(model.CurrentPage, Is.EqualTo(3));
            Assert.That(model.Content.Count, Is.EqualTo(0));
        }
        public void GetPages_ViewIsIndex()
        {
            //arrange
            var blogRepositoryMock = CreateRepositoryMock(10);
            var controller = new PostsController(blogRepositoryMock.Object);

            //act
            var result = controller.Page(1) as ViewResult;

            //assert
            Assert.That(result.ViewName, Is.EqualTo("Index"));
        }
        public void GetIndexTotalPagesIsCorreclyCalculated_ElevenPost_MakesThreePage()
        {
            //arrange
            var blogRepositoryMock = CreateRepositoryMock(11);
            var controller = new PostsController(blogRepositoryMock.Object);

            //act
            var result = controller.Index() as ViewResult;

            //assert
            var model = result.ViewData.Model as BlogPosts;
            Assert.That(model.TotalPages, Is.EqualTo(3));
        }