public void Should_match_all_methods_matching_the_required_signature() { var subject = new ReflectionEventSubscriber(new EventTest()); Action<int> i; subject.TryGetEventHandler(out i).Should().BeTrue(); Action<string> str; subject.TryGetEventHandler(out str).Should().BeTrue(); Action<byte> b; subject.TryGetEventHandler(out b).Should().BeFalse(); Action<bool> boolean; subject.TryGetEventHandler(out boolean).Should().BeFalse(); Action<bool> c; subject.TryGetEventHandler(out c).Should().BeFalse(); }
public bool TryGetEventHandler <TEvent>(out Action <TEvent> handler) { //if (typeof(TEvent) != typeof(CommandStartedEvent)) //{ // handler = null; // return false; //} //handler = e => //{ //}; //return true; return(_Subscriber.TryGetEventHandler(out handler)); // looks for a function called Handle that takes the type of event and returns void }
public bool TryGetEventHandler <TEvent>(out Action <TEvent> handler) { return(_subscriber.TryGetEventHandler(out handler)); }
public bool TryGetEventHandler <TEvent>(out Action <TEvent> handler) => _subscriber.TryGetEventHandler(out handler);