【发布时间】:2012-05-29 23:02:27
【问题描述】:
是否可以使用 Rhino Mocks 创建一个存根,为所有调用抛出异常?
public interface IMyIF
{
// Some methods
}
[TestClass]
public class MyTestClass
{
[TestMethod()]
public void MyTest()
{
MockRepository mocks = new MockRepository();
IMyIF stb = mocks.Stub<IMyIF>();
// Somehow set stb to throw some exception on every method call
// without knowing all the methods and overloads in IMyIF interface
// use stb to test something
}
}
【问题讨论】:
标签: .net unit-testing rhino-mocks stub