Created
October 30, 2012 21:13
-
-
Save wayne-o/3983099 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void When_requesting_the_admin_categories_page_result_is_correct() | |
{ | |
const int expectedCategoryCount = 3; | |
const string expectedViewName = "Categories"; | |
var repository = new Mock<IRepository<Category>>(); | |
repository.Setup(x => x.GetAll()).Returns(new List<Category> | |
{ | |
new Category(), | |
new Category(), | |
new Category() | |
}); | |
var controller = new AdminController(repository.Object); | |
var result = controller.Categories(); | |
result.Should().BeAssignableTo<ActionResult>(); | |
result.AssertViewRendered().ForView(expectedViewName); | |
result.Model.Should().BeAssignableTo<CategoriesListViewModel>(); | |
((CategoriesListViewModel) result.Model).Categories.Count.Should().Be(expectedCategoryCount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment