Multiple approaches exist to write your unit tests when using Rhino Mocks:
What is the ideal and most frictionless way?
Mock OptionsStrict Mock. A strict mock requires you to provide alternate implementations for each method/property that is used on the mock. If any methods/properties are used which you have not provided implementations for, an exception will be thrown. Dynamic Mock.
For .NET 2.0, I recommend the record/playback model. We like this because it separates clearly your expectations from your verifications.
using(mocks.Record())
{
Expect.Call(foo.Bar());
}
using(mocks.Playback())
{
MakeItAllHappen();
}
If you're using .NET 3.5 and C# 3, then I'd recommend the fluent syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With