Thursday, June 19, 2008

We switched from NCover to NCover 2.0

NCover is an invaluable part of our continuous integration server. (In conjunction with NCoverCop [shameless plug]).

We recently splashed out on the commercial version [NCover 2.0] rather than use the open source version with an aim to speed up the build.

The upgrade was pretty painless. I needed to extend NCoverCop to process the new file format, so the next version will now handle both. It can even compare one against the other.

The results

We managed to shave 2 minutes off the build. Every little helps!

Tuesday, June 17, 2008

Mocking Generic Method with NMock2 (part2)

Well although this feature has been mentioned on the web it doesn't seen to exist in any version of NMock2 I can find. With a bit of digging I worked out how to implement it myself.

You can download the assembly from NMock2Extensions try it out, or download the source from svn.

Here's an example of using it...

.Method(new GenericMethodMatcher("Get", typeof(IControl)))

.Method(new GenericMethodMatcher("Get",typeof(IDocument)))

As you can see, you can Stub or Mock on the same method with different generic types and they are handled differently, as you would expect.

Happy Mocking

Wednesday, June 11, 2008

Getting Started with NDI

Check out Getting Started with NDependencyInjection. I'm looking for some feedback. How readable/followable is it?

Sunday, June 01, 2008

Mocking templated methods with NMock2

Mocking a method like T GetSomething();

This is something that I have resorted to RinoMock to achieve in the past...
... well it turns out you can do it with NMock2 v1.0 as follows:

Expect.Once.On(a).Method("GetSomething", typeof(int)).Will(Return.Value(42));

I've tried to find this before.. and failed.. so I thought I should blog it to make it easier to find in google.

Thanks to ursenzler for commenting on

GitHub Projects