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,124 | Comments: 45,470

filter by tags archive

Rhino Mocks 3.6

time to read 2 min | 277 words

This release is mostly to put out all the patches & fixes that went into Rhino Mocks since the 3.5 release, almost a year ago.

The changes from the previous version are:

  • Dynamic mocks and stubs will now assume that a call is match by any number of expectation.
  • Recursive mocks (with help from webpaul)
  • Fixing an issue with ArgManager in multi threaded scenarios (patch from Stefan Steinegger)
  • Fixing problem with IgnoreArguments() after Do() erasing the Do()
  • Fixing an issue with SetPropertyWithArgument improperly using LastCall.
  • Allowing Rhino Mocks to raise events on VB6 dlls.
  • Adding support for AssertWasCalled for getters (patch from robin clowers)
  • Adding remoting mocks as static methods (patch from Peter Mounce)
  • Adding a way to access the method from MethodInvocation
  • Fixing an issue with recursive return types when making a call to record an event more than once.
  • Various spelling & grammar issues (patch from Peter van der Woude)
  • Fixing an issue with stubbing MarshalByReferenceObjects
  • Better integration with Pex
  • Making LambdaConstraint work better with polymorphic args
  • Better feature parity for AAA with Record & Playback: Partials, Multis, and Stricts
  • Fixing an issue with stubbing properties of generic interfaces implemented twice using different generic parameters (Alexander Groß)

As usual, the download is here.



as a Moq user how would you "sell" Rhino Mocks to me (no offense, just currious)?

I somehow skipped RhinoMocks (wasn't tdd guy before) but it already went away with the record-replay, and the 2 frameworks seems identical...so can you be a good salesman and persuade me to use it?

Rhino is your baby so I would like to have some comparison between the two. (I know google will spit something out but...)

or you can be a diplomat and say "try it, you'll love it" :D

Ayende Rahien


I wouldn't, use whatever fits your needs


I'm a little confused probably:

"Dynamic mocks and stubs will now assume that a call is match by any number of expectation."

Does this mean that from now on: myMock.Stub(...) == myMock.Stub(...).Repeat.Any()

and: myMock.Expect(...) == myMock.Expect(...).Repeat.Any() ?

Shane Courtrille

I'd sell you on Rhino Mocks by saying it doesn't do a MyMock.Object to get at the actual object. From what I've heard that's the main complaint.

I'd sell you on Moq by saying the API usage is MUCH cleaner. There aren't N ways to do one thing.

I'm still hoping that at some point we see a Rhino Mocks release that removes backwards compatibility for everything not AAA.


Shane, +1 to hoping for a release one day that removes the record/replay syntax.

It doesnt bother me, but I think its definitely an issue for getting new users on board

Noam Gal

I tried dropping in 3.6 over my 3.5 in a .NET 2.0 project. Apparently I now need system.core.dll 3.5 for the RhinoMocksExtensions calls.

Is it a conscious decision to stop supporting 2.0, or am I missing something?

Ayende Rahien


3.6 doesn't support 2.0 anymore

Noam Gal

Something worth mentioning...

In any case, I did manage to get it to run on my 2.0 project. Only had to add the above reference (I do have 3.5 installed). So far it worked, though I am not doing a whole lot of stuff with it yet, so maybe it'll fail on more complex scenarios.

The recursive mocks are very nice indeed.


Sounds like a test-breaking change. I'd say that would be ok for Stub but is too much change for Expect, but I'd also say to keep the behavior of both as similar as possible...

Any specific reasons for this?

Ayende Rahien

It was the expected behavior from the users point of view.

Kurt Harriger


I had a few dozen tests fail after upgrading to v 3.6 from code like this:

var mocks = new MockRepository();

var something = mocks.Stub <isomthing();

something.Stub(x=>x.DoSomething() ).Return(true);


The root cause of the problem appears that mock.Stub/Mock/etc no longer returns the mock in replay mode. To fix replaced mock.Stub with MockRepository.GenerateStub.

Ayende Rahien


That is actually expected, that should have never worked, you are mixing the two styles of working together

Jiho Han

w.r.t. .net 2.0 support, I tried to download v3.5 for 2.0 but they still required System.Core.dll

Like, Noam above, do I need to add reference to System.Core.dll in my 2.0 project?



Just to let you know that I'm having problems with rhino mocks 3.6 and nunit 2.5.*

I'm running nunit console using a project file containing 20 assemblies. All tests pass but it fails with the following:

Unhandled Exception:

System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.

at System.AppDomain.get_FriendlyName()

at NUnit.Util.DomainManager.DomainUnloader.Unload()

at NUnit.Util.DomainManager.Unload(AppDomain domain)

at NUnit.Util.TestDomain.Unload()

at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)

at NUnit.ConsoleRunner.Runner.Main(String[] args)

I can get it to succeed if I take out some of the assemblies under test but never consistently the same assembly so it doesn't look like my code. All assemblies are targeting 3.5. If I revert back to nunit 2.4.7 everything works fine.

It might be something to do with nunit but I thought I'd let you know.

Ayende Rahien

It is an NUnit thingie.

We had the same problem with Castle

Comment preview

Comments have been closed on this topic.


  1. RavenDB 3.5 whirl wind tour: You want all the data, you can’t handle all the data - about one day from now
  2. The design of RavenDB 4.0: Making Lucene reliable - 3 days from now
  3. RavenDB 3.5 whirl wind tour: I’ll find who is taking my I/O bandwidth and they SHALL pay - 4 days from now
  4. The design of RavenDB 4.0: Physically segregating collections - 5 days from now
  5. RavenDB 3.5 Whirlwind tour: I need to be free to explore my data - 6 days from now

And 14 more posts are pending...

There are posts all the way to May 30, 2016


  1. RavenDB 3.5 whirl wind tour (14):
    29 Apr 2016 - A large cluster goes into a bar and order N^2 drinks
  2. The design of RavenDB 4.0 (13):
    28 Apr 2016 - The implications of the blittable format
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats