public void Recent_Calls_Repository_ListRecentPosts()
        {
            // Arrange
            List<Post> expectedPosts = new List<Post>() { _samplePost };
            int retrievalCount = expectedPosts.Count;

            Mock<IPostRepository> repositoryMock =
               new Mock<IPostRepository>();
            repositoryMock.Setup(
               m => m.ListRecentPosts(retrievalCount))
                  .Returns(expectedPosts);
            BlogController blogController =
               new BlogController(repositoryMock.Object);

            // Act
            IEnumerable<Post> actualPosts =
              blogController.Recent(retrievalCount);

            // Assert
            Assert.Equal(expectedPosts, actualPosts);
        }
        public void Add_Calls_Repository_Add()
        {
            // Arrange
            Post createdPost = null;

            Mock<IPostRepository> repositoryMock =
              new Mock<IPostRepository>();
            repositoryMock.Setup(
              (m) => m.Add(_samplePost))
              .Callback<Post>(p =>
              {
                  createdPost = p;
              });

            BlogController blogController =
              new BlogController(repositoryMock.Object);

            // Act
            blogController.Add(_samplePost);

            // Assert
            Assert.Equal(_samplePost, createdPost);
        }