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
}
}