ajoo同学的酒窝有.NET版本啦!
项目主页:
http://dotnet.dimple.googlepages.com/home
存在意义:
快速制作测试用的stub。手工继承,mock框架之外的第三种选择。
简单使用:
Output:
Hello
独家特性:
Output:
Hello
项目主页:
http://dotnet.dimple.googlepages.com/home
存在意义:
快速制作测试用的stub。手工继承,mock框架之外的第三种选择。
简单使用:
public class StubDbCommand
{
public object ExecuteScalar()
{
return "Hello";
}
public static DbCommand New()
{
return NDimple.Implement<DbCommand>(new StubDbCommand());
}
}
Console.WriteLine(StubDbCommand.New().ExecuteScalar());
{
public object ExecuteScalar()
{
return "Hello";
}
public static DbCommand New()
{
return NDimple.Implement<DbCommand>(new StubDbCommand());
}
}
Console.WriteLine(StubDbCommand.New().ExecuteScalar());
Output:
Hello
独家特性:
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());
{
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