Skip to content

Instantly share code, notes, and snippets.

@davetheninja
Created September 17, 2009 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davetheninja/188466 to your computer and use it in GitHub Desktop.
Save davetheninja/188466 to your computer and use it in GitHub Desktop.
[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