Exemplo n.º 1
0
        public void ByCategoryGetsPostsInCategoryFromRepository()
        {
            var expectedCategory = new Category {
                UrlName = "CategoryUrlName"
            };

            Mock.Get(repository)
            .Setup(r => r.ByCategory(expectedCategory))
            .Returns(sampleEntities);

            var result = controller.ByCategory(expectedCategory).Model as PostListViewModel;

            Mock.Get(repository).Verify(r => r.ByCategory(expectedCategory));

            Assert.IsNotNull(result);
            Assert.That(result.Posts, Is.EqualTo(sampleSummaries));
            Assert.That(result.Title, Is.EqualTo("CategoryFullName"));
        }