Ayende @ Rahien

It's a girl

Rhino Mocks 3.5 Beta Released

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
06/04/2008 01:42 PM by
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
06/04/2008 01:45 PM by
Ayende Rahien

Ivaylo,

Right now, I don't think you can.

Please post this to the list.

Ivaylo Bratoev
06/04/2008 02:57 PM by
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
06/04/2008 04:14 PM by
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
06/04/2008 07:18 PM by
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.

Comments have been closed on this topic.