Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive

Rhino Mocks 3.5 Beta Released

time to read 2 min | 243 words

3 Months ago I released Rhino Mocks 3.4, we have made some great improvement to Rhino Mocks in the meantime, and it is time for a new release. I generally don't believe in beta releases for Rhino Mocks, but this time we are coming up with a new syntax, and I want to get additional external input before we make a final release on that.

The biggest new feature is the new AAA syntax, which you can read about in the relevant post, but we had a few other new things as well.

  • CreateMock() is deprecated and marked with the [Obsolete] attribute. Use StrictMock() instead.
  • Better handling of exception in raising events from mock objects
  • Fixing an issue with mock objects that expose methods with output parameter of type System.IntPtr.
  • Allowing to return to record mode without losing expectations, thanks to Jordan Terrel, for submitting this patch.

I intend to write a lot more documentation about the new AAA syntax, but for now, you can visit the tests for the feature, to see how it works.

As usual, you can find the bits here.

Note that this release if for .Net 3.5 only. Rhino Mocks 3.5 RTM will be for .Net 2.0 and 3.5, but I am focusing on the capabilities that I can get from the 3.5 platform at the moment.


Ivaylo Bratoev

This syntaxis is really cool. The AAA model seems more natural than the record-replay. I have one issue with it - how assert that a method on a stub with 0 parameters was called only once?

Ayende Rahien


Right now, I don't think you can.

Please post this to the list.

Ivaylo Bratoev

Thanks for the fast response.

Do I guess properly that I cannot set up return values on readonly properties of a stub?

And, Ayende, what list do you refer to?

Ayende Rahien

You can setup return values for stubs, yes.

Same way you use it elsewhere.

Rhino Mocks mailing list on google groups

Ivaylo Bratoev

Actually, I wrote that I cannot set up values on read only properties of a stub. I used this code:

var person = MockRepository.GenerateStub();

person.Stub(x => x.IsGeek).Return(true);

What confused me was that person.IsGeek property returns true only the first time. I have to add ...Repeat.Any() to make it work properly.

I think that for STUBS the default behavior should be ...Repeat.Any() not Repeat.Once(). What do you think of that?

I posted both issues on the mailing list.

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats