Rhino Mocks是否可以創建一個存根,並引發所有調用的異常?如何創建存根,在Rhino mock中的所有調用中拋出異常?
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
}
}
現在已經夠好了,但是如果我想拋出特定的異常呢? –
我不認爲這是可能的與犀牛嘲笑。 –
爲什麼要創建存根呢?代替傳遞'null' –