Created
September 17, 2009 12:28
-
-
Save davetheninja/188466 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
[Subject(typeof(ManagementController), "user management")] | |
public class when_viewing_a_list_of_all_users : as_controller<ManagementController, ViewResult> | |
{ | |
Establish context = () => | |
{ | |
new AutoMapperBootPart().Execute(null); | |
_repository = MockRepository.GenerateStub<IRepository>(); | |
_repository.Expect(a => a.QueryList(Arg<GetAllUsersForManagementListQuery>.Is.Anything)).Return(new List<User> { new User(), new User() }); | |
InitializeController(new ManagementController(_repository)); | |
}; | |
Because of = () => ActionToExecute(x => x.Index()); | |
It should_load_the_users_list = () => _repository.AssertWasCalled(a => a.QueryList(Arg<GetAllUsersForManagementListQuery>.Is.Anything)); | |
It should_add_the_users_list_to_the_view_model = () => | |
{ | |
var viewData = (UserManagementListUserViewModel) Result.ViewData.Model; | |
viewData.Users.Length.ShouldEqual(2); | |
}; | |
static IRepository _repository; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment