Exemple #1
0
        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>());
        }
Exemple #2
0
        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);
        }