public void TestEventListenerBinds() { _eventContext.ContextBindEventListener(EventKey.Test, _subListener1); _eventContext.TriggerEvent(EventKey.Test, new EventPayload("null", null)); _eventContext.TriggerEvent(EventKey.Test, new EventPayload("null", null)); _eventContext.TriggerEvent(EventKey.Test, new EventPayload("null", null)); //Assert _subListener1.Received(3).ReceiveEvent(_eventContext.GetEvent(EventKey.Test), Arg.Any <EventPayload>()); }
public void SetUp() { _eventLogger = new EventLogger(); _eventContext = new EventContext(); _subServiceContext = TestUtilities.BuildSubServiceContextWithServices(new Dictionary <string, object> { { "IEventLogger", _eventLogger }, { "IEventContext", _eventContext } }); _eventContext.Build(); _eventContext.BindServiceContext(_subServiceContext, "IEventContext"); _eventContext.Initialize(); _eventContext.ResolveServiceBindings(); _subListener = Substitute.For <IListener>(); _eventContext.ContextBindEventListener(EventKey.Test, _subListener); _eventContext.ContextBindEventListener(EventKey.Test2, _subListener); }