NDimple


Dynamically implement a type for you

Download 1.0 Version

NDimple.dll 

NDimple.zip 

Features 

Implement Interface

Implement Abstract Class

Proxy abstract methods

Proxy virtual methods

Proxy could be abstract type

Google Code

 Go to project page

Articles

why do we need mock framework? 

What is NDimple?

It's a .NET version of Dimple framework

Why I need NDimple?

You can use this framework to make stub when do unit testing. If you want to implement a huge interface, check this out. If you want to override one abstract method among a huge abstract class, check this out. If you want to start using mock framework to simulate behavior more complex than get set, check this out.

Is it easy?

public class StubDbCommand
{
public object ExecuteScalar()
{
return "Hello";
}
public static DbCommand New()
{
return NDimple.Implement<DbCommand>(new StubDbCommand());
}
}

Console.WriteLine(StubDbCommand.New().ExecuteScalar());

Output:

Hello

Protected Abstract Method?

public abstract class AbstractClass
{
protected abstract string AbstractMethod1();
protected abstract string AbstractMethod2();
public string InvokeAbstractMethod1()
{
return AbstractMethod1();
}
}

public abstract class StubAbstractClass : AbstractClass
{
protected override string AbstractMethod1()
{
return "Hello";
}
public static AbstractClass New()
{
return NDimple.Implement<AbstractClass>(typeof (StubAbstractClass));
}
}

Console.WriteLine(StubAbstractClass.New().InvokeAbstractMethod1());

Output:

Hello

Sign in  |  Recent Site Activity  |  Terms  |  Report Abuse  |  Print page  |  Powered by Google Sites