Can I "inherit" a delegate? Looking for ways to combine Moq and MSpec without conflicts around It...

Posted by Tomas Lycken on Stack Overflow See other posts from Stack Overflow or by Tomas Lycken
Published on 2010-05-22T22:42:05Z Indexed on 2010/05/22 22:50 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

I have started to use MSpec for BDD, and since long ago I use Moq as my mocking framework. However, they both define It, which means I can't have using Moq and using Machine.Specifications in the same code file without having to specify the namespace explicitly each time I use It. Anyone who's used MSpec knows this isn't really an option.

I googled for solutions to this problem, and this blogger mentions having forked MSpec for himself, and implemented paralell support for Given, When, Then.

I'd like to do this, but I can't figure out how to declare for example Given without having to go through the entire framework looking for references to Establish, and changing code there to match that I want either to be OK.

For reference, the Establish, Because and It are declared in the following way:

public delegate void Establish();
public delegate void Because();
public delegate void It();

What I need is to somehow declare Given, so that everywhere the code looks for an Establish, Given is also OK.

© Stack Overflow or respective owner

Related posts about c#

Related posts about inheritance