Thursday, April 28, 2011

Extension methods in Mono 2.4 and RhinoMocks 3.5

I am playing around with MonoDevelop 2.0 and Mono 2.4 in Ubuntu.

I have run into problems with extension methods not being available (eg mockView.Stub(...)) in RhinoMocks 3.5 for AAA style tests. I downloaded the RhinoMocks dll from Ayende's site rather than compiled from source. My project in MonoDevelop is setup to target framework 3.5

Using the RhinoMocks c#2.0 syntax with static methods on the RhinoMocksExtensions class works. (e.g RhinoMocksExtensions.Stub(authSvc, delegate(IAuthService svc))

Should AAA syntax (and RhinoMocks in general) work with Mono 2.4 or is it likely I've not setup something correctly?

Thanks in advance

Neil

From stackoverflow
  • Ensure that you are referencing System.Core

    Dykam : Extension methods aren't related to System.Core, are they?
    skolima : They are. Some attributes from this assembly are needed.
    Neil : Thanks that did the trick as far as the compiler is concerned. Intellisense in MonoDevelop 2.0 doesn't pick up the extension methods but I can live with that - hopefully it'll be sorted in the upcoming 2.2 release.

0 comments:

Post a Comment