3

The Moles documentation describes how to raise events on class stubs but the same method doesn't work with a full Mole. You can add a delegate to the add / remove methods, but you can't manually raise the event.

The only solution I can think of is to create a RaiseEvent() method on the class being tested, but that kinda defeats the point of using moles.

Any suggestions?

4

1 回答 1

3

事实证明,您可以在事件上添加 Add 方法并在那里获取事件处理程序。一旦有了事件处理程序,您就可以手动调用它,模拟事件。

于 2010-11-08T11:00:52.243 回答