Created
October 30, 2012 19:43
-
-
Save wayne-o/3982524 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
[TestFixture] | |
public class AdminControllerBehaviors | |
{ | |
[Test] | |
public void When_requesting_the_admin_categories_page_result_is_correct() | |
{ | |
const string expectedViewName = "Categories"; | |
var repository = new Mock<IRpository<Category>>(); | |
var controller = new AdminController(repository.Object); | |
var result = controller.Categories(); | |
result.Should().BeAssignableTo<ActionResult>(); | |
((ViewResult) result).ViewName.Should().Be(expectedViewName); | |
} | |
[Test] | |
public void When_requesting_the_admin_categories_add_page_result_is_correct() | |
{ | |
const string expectedViewName = "Categories"; | |
var repository = new Mock<IRpository<Category>>(); | |
var controller = new AdminController(repository.Object); | |
var result = controller.CategoriesAdd(); | |
result.Should().BeAssignableTo<ActionResult>(); | |
((ViewResult)result).ViewName.Should().Be(expectedViewName); | |
} | |
[Test] | |
public void When_requesting_the_admin_categories__add_post_page_result_is_correct() | |
{ | |
var repository = new Mock<IRpository<Category>>(); | |
var controller = new AdminController(repository.Object); | |
var viewModel = new CategoriesAddViewModel(); | |
var result = controller.CategoriesAdd(viewModel); | |
result.Should().BeAssignableTo<RedirectToRouteResult>(); | |
((RedirectToRouteResult)result).RouteValues["Action"].Should().Be("Categories"); | |
((RedirectToRouteResult)result).RouteValues["Controller"].Should().Be("Admin"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment