Ayende @ Rahien

Refunds available at head office

Rhino Mocks 3.5 Release Candidate

Well, after a much longer beta period, and getting some very valuable input, Rhino Mocks 3.5 is out in Release Candidate. I am putting this out as RC, but I am pretty sure that those bits would be the RTM version as well.

The only major task left is to start documenting the changes. The move to 3.5 has made a lot changes in approach that I recommend to use (note that the API is compatible with 3.4).

I would like to thank Jordan Terrell, David Tchepak, Stefan Steinegger, Jason Meckley, Scott Brady, Ernst Naezer, Roelof Blom and Aaron Jensen for helping me get this out the door.

The changes (from 3.4) are:

  • Assert Act Arrange syntax, of course.
  • 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.
  • Inline constraints:
  • [Test]
    public void WhenUserForgetPasswordWillSendNotification_WithConstraints()
    {
        var userRepository = MockRepository.GenerateStub<IUserRepository>();
        var notificationSender = MockRepository.GenerateStub<INotificationSender>();
    
        userRepository.Stub(x => x.GetUserById(5)).Return(new User { Id = 5, Name = "ayende" });
    
        new LoginController(userRepository, notificationSender).ForgotMyPassword(5);
    
        notificationSender.AssertWasCalled(x => x.Send(Arg.Text.StartsWith("Changed") ));
    }
  • CreateMock() is deprecated and marked with the [Obsolete] attribute. Use StrictMock() instead.
  • Fixed an issue with merging, would cause issues if you are also using Castle Dynamic Proxy.
  • Fixed various typos
  • Better error handling for AAA syntax abuse
  • Will give better errors if you call Verify on a mock that is in record mode.
  • BackToRecord extension method.
  • Can mock interfaces with modopt params.
    • If you don't know what this means, it means that you can now mock interfaces that C++/CLI generates under some conditions (mixing native types with CLR types). This is probably the longest standing bug in Rhino Mocks.
  • Fixed issue with mocking internal classes and interfaces.
  • Full XML documentation
  • New event raising syntax:
    eventHolder.Raise(stub => stub.Blah += null, this, EventArgs.Empty);
  • AAA syntax now works with Ordering
  • Better error message if trying to use SetupResult on stubbed mock properties.

There are a lot of goodies in this release.

I am starting to create the documentation for this release here. This is a wiki, any help would be appreciated.

You can get the new version, for both 3.5 and 2.0 from the download page.

Comments

Chad Myers
06/29/2008 02:28 AM by
Chad Myers

Great job! And thanks to all the contributors too.

We'll probably start using this right away.

PandaWood
06/29/2008 02:31 AM by
PandaWood

If I go to the wiki (http://www.ayende.com/Wiki/Register.aspx) and try to create a new user login, whatever I type as a password it says "invalid password" and shows a red icon, but there's no indication what a 'Valid' password is.

Ayende Rahien
06/29/2008 02:58 AM by
Ayende Rahien

The password is at least 7 characters

Jeremy Gray
06/29/2008 03:06 AM by
Jeremy Gray

Awesome! Talk about great timing, given our emails of the last 24 hours! ;)

I'm very much looking forward to giving this a go with the team this week!

Andrew
07/03/2008 07:00 AM by
Andrew

Hi Oren,

I noticed the RC is exposing some of the Castle.Core classes publicly. I'm not sure if this was intended - but causes an ambiguous reference error if you have an assembly that references both Castle.Core.dll and Rhino.Mocks.dll...

Any chance you can re-internalise them?

Ayende Rahien
07/09/2008 06:30 AM by
Ayende Rahien

Yes, they would be internal

Comments have been closed on this topic.