Ayende @ Rahien

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

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 18 | Comments: 79

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.


Comments

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

Ivaylo,

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.

FUTURE POSTS

  1. Production postmortem: The industry at large - 7 hours from now
  2. The insidious cost of allocations - about one day from now
  3. Buffer allocation strategies: A possible solution - 4 days from now
  4. Buffer allocation strategies: Explaining the solution - 5 days from now
  5. Buffer allocation strategies: Bad usage patterns - 6 days from now

And 2 more posts are pending...

There are posts all the way to Sep 11, 2015

RECENT SERIES

  1. Find the bug (5):
    20 Apr 2011 - Why do I get a Null Reference Exception?
  2. Production postmortem (10):
    01 Sep 2015 - The case of the lying configuration file
  3. What is new in RavenDB 3.5 (7):
    12 Aug 2015 - Monitoring support
  4. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats