Rhinos Mocks was touched on by Steve Bohlen in his last talk at the Dallas Day of Dot Net convention today. I had done a pretty good job of staying alert during the past two days as I diligently scribbled notes and took iPhone pictures of slides while engrossed by the talks, but I finally started to space out during the last session of the conference. That was alright as the talk was on "Effective Test-Driven Development with Mock Objects" and turned out to mostly cover concepts I had already been exposed to. One thing that was new for me presented itself in examples which were of Rhino Mocks in lieu of MOQ. Here is some of Mr. Bohlen's code from one of his slides. You'll note the difference in syntax.
[Test]
public void Can_Send_Email_about_Successful_shipping()
{
var validator = MockRepository.GenerateStub<IOrderProcessingValidator>();
var customer = new Customer(){ Email = "sbohlen@gmail.com" };
validator.Expect(val => val.Validate(customer, new
Order())).IgnoreArguments.Return(true);
var emailer = MockRepository.GenerateMock<IEmailSender>();
emailer.Expect(em => em.Send(customer.Email, true));
OrderProcessingService service = new OrderProcessingService(validator);
more code here...
No comments:
Post a Comment