我想測試一個類有EventHandler分配給一個事件。基本上我使用我的IoC容器爲我連接EventHandlers,並且我想檢查它們是否正確分配。所以真的,我正在測試我的IoC配置。測試一個事件有一個EventHandler分配
[Test]
public void create_person_event_handler_is_hooked_up_by_windsor()
{
IChangePersonService changePersonService = IoC.Resolve<IChangePersonService>();
// check that changePersonService.PersonCreated has a handler attached
}
我不知道如何測試changePersonService.PersonCreated有任何附加到它雖然。
任何想法?
謝謝。
謝謝布魯諾,我想這就是我要做的。 – mattcole 2009-01-07 15:19:43