public void LastArticleFromBlog_IfNoPostsInRepo_ReturnEmptyView()
        {
            // arrange
            var posts = new Mock<IBlogPostsRepository>();
            var controller = new HomeController(posts.Object);

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

            // assert
            Assert.That(result.ViewData.Model, Is.Null);
        }
        public void LastArticleFromBlog_ThereArePostsInRepo_ReturnsLastPost()
        {
            // arrange
            var posts = new Mock<IBlogPostsRepository>();
            var controller = new HomeController(posts.Object);

            var postsInRepo = CreatePostsList();
            posts.Setup(p => p.BlogPosts).Returns(postsInRepo.AsQueryable());

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

            // assert
            var post = result.ViewData.Model as LastArticleFromBlogModel;
            Assert.That(post, Is.Not.Null);
            Assert.That(post.Title, Is.EqualTo("Second"));
        }