I just finished a framework that resolves (or tries to resolve) that problem.
for instance
[Test]
public void WhenUserForgetPasswordWillSendNotification_WithArgumentMatching()
{
var userRepository = MockRepository.GenerateStub<IUserRepository>();
var notificationSender = MockRepository.GenerateStub<INotificationSender>();
userRepository.Stub(x => x.GetUserById(5)).Return(new User { Id =
5, Name = "ayende" });
new LoginController(userRepository, notificationSender).ForgotMyPassword(5);
notificationSender.AssertWasCalled(x => x.Send("Changed password
for ayende"));
}
could be written like
[TestClass]
public class Given_LoginController : BehaviorOf<LoginController> {
[TestMethod]
public void WhenUserForgetPasswordWillSendNotification_WithArgumentMatching()
{
Given.UserRepository.GetUserById(5).WillReturn(new User { Id = 5,
Name = "ayende" });
When.ForgotMyPassword(5);
Should.NotificationSender.Send("Changed password for ayende");
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---