public void CanInterceptEventsMethods() { CallCountInterceptionBehavior interceptor = new CallCountInterceptionBehavior(); ClassWithAVirtualEvent instance = WireupHelper.GetInterceptingInstance <ClassWithAVirtualEvent>(); ((IInterceptingProxy)instance).AddInterceptionBehavior(interceptor); instance.SomeEvent += (sender, args) => { }; Assert.AreEqual(1, interceptor.CallCount); }
public void FiringAnEventIsNotIntercepted() { CallCountInterceptionBehavior interceptor = new CallCountInterceptionBehavior(); ClassWithAVirtualEvent instance = WireupHelper.GetInterceptingInstance <ClassWithAVirtualEvent>(); ((IInterceptingProxy)instance).AddInterceptionBehavior(interceptor); instance.SomeEvent += (sender, args) => { }; instance.TriggerIt(); Assert.AreEqual(1, interceptor.CallCount); }