public async Task InvokeMessageHandlersForEventMessageAsync_ShouldInvokeCorrectHandlerOverloadForType(Type eventType, string expectedMethod) { var @implicit = new MultiTypeImplicitHandler(); var @explicit = new MultiTypeExplicitHandler(); _eventTypeResolverMock.Setup(x => x.Resolve(It.IsAny <string>())).Returns(eventType); var handlers = new IHandleEventsOf <object>[] { @implicit, @explicit }; await _subscriber.InvokeMessageHandlersForEventMessageAsync(StreamName, eventType, handlers, Activator.CreateInstance(eventType), EventInfo); @implicit.Method.Should().Be(expectedMethod, "The expected method overload was not called on implicit handler"); @explicit.Method.Should().Be(expectedMethod, "The expected method overload was not called on explicit handler"); }
public async Task InvokeMessageHandlersForEventMessageAsync_ShouldInvokeFoundHandlersForInterfaceType() { var @implicit = new SomeImplicitHandlerForInterface(); var @explicit = new SomeExplicitHandlerForInterface(); _eventTypeResolverMock.Setup(x => x.Resolve(It.IsAny <string>())).Returns(typeof(EventAWithInterface)); var handlers = new IHandleEventsOf <IEvent>[] { @implicit, @explicit }; await _subscriber.InvokeMessageHandlersForEventMessageAsync(StreamName, typeof(EventAWithInterface), handlers, new EventAWithInterface(), EventInfo); @[email protected]().NotBeNull(); @[email protected]().NotBeNull(); }