public void FoundNoHandlers() { Type pubType = typeof(SimpleEventPublisher); EventInfo[] events = pubType.GetEvents(); foreach (EventInfo currentEvent in events) { Type eventHandlerType = currentEvent.EventHandlerType; MethodInfo invoke = eventHandlerType.GetMethod("Invoke"); Assert.IsNull(EventManipulationUtils.GetMethodInfoMatchingSignature(invoke, typeof(NoEventSubscriber))); } }
public void FoundSomeEventHandlers() { Type pubType = typeof(SimpleEventPublisher); EventInfo[] events = pubType.GetEvents(); foreach (EventInfo currentEvent in events) { Type eventHandlerType = currentEvent.EventHandlerType; MethodInfo invoke = eventHandlerType.GetMethod("Invoke"); if (currentEvent.Name == "MyFirstEvent" || currentEvent.Name == "MySecondEvent") { Assert.IsNotNull(EventManipulationUtils.GetMethodInfoMatchingSignature(invoke, typeof(SomeEventSubscriber))); } else { Assert.IsNull(EventManipulationUtils.GetMethodInfoMatchingSignature(invoke, typeof(SomeEventSubscriber))); } } }