NUnit, C#, Mock objects

Caporegime
Joined
18 Oct 2002
Posts
29,493
Location
Back in East London
Anyone use NUnit on C#? Tried using it's mock framework for the first time today, and it seems I have to mock an interface, can't mock a class.. is this right?

Going by an example I found on the web, I try to instantiate like so:
Code:
DynamicMock mock = new DynamicMock(typeof(ClassIAmMocking));
but that spits an exception, complaining it's not the right type?

I hate type strict languages :(
 
Ok, ta for info. I've had possibly more experience with mocks and testing than most developers tbh, I am the lead contributor to SSpec and BDD for Smalltalk, also a main contributor to many xUnit and xSpec frameworks, it just seems odd that NUnit expects an interface, when it should expect an interface or a class.

I'll look into Rhino Mocks when back at work, ta :)
 
Last edited:
Back
Top Bottom