Exemplo n.º 1
0
        public void Unsubscribe_SHOULD_SUCCESS()
        {
            var logger      = NullLogger <MemoryEventBus> .Instance;
            var bus         = new MemoryEventBus(logger);
            var fakeHandler = new EventAHandler();


            bus.Unsubscribe(fakeHandler);
        }
Exemplo n.º 2
0
        public void IDisposableUnsubscribe_SHOULD_SUCCESS()
        {
            var logger      = NullLogger <MemoryEventBus> .Instance;
            var bus         = new MemoryEventBus(logger);
            var fakeHandler = new EventAHandler();

            var disposabler = bus.Subscribe(fakeHandler);

            disposabler.Dispose();
        }
Exemplo n.º 3
0
        public void Subscribe_SHOULD_SUCCESS()
        {
            var logger      = NullLogger <MemoryEventBus> .Instance;
            var bus         = new MemoryEventBus(logger);
            var fakeHandler = new EventAHandler();

            var disposabler = bus.Subscribe(fakeHandler);

            Assert.NotNull(disposabler);
        }
Exemplo n.º 4
0
        public async Task Publish_SHOULD_SUCCESS()
        {
            var logger      = NullLogger <MemoryEventBus> .Instance;
            var bus         = new MemoryEventBus(logger);
            var fakeHandler = new EventAHandler();
            var fakeEvent   = new EventA();

            bus.Subscribe(fakeHandler);
            await bus.Publish(fakeEvent, CancellationToken.None);

            Assert.True(fakeEvent.Called);
        }
Exemplo n.º 5
0
        public async Task Publishs_SHOULD_SUCCESS()
        {
            var logger      = NullLogger <MemoryEventBus> .Instance;
            var bus         = new MemoryEventBus(logger);
            var fakeHandler = new EventAHandler();
            var events      = new Event[] { new EventA(), new EventA(), new EventA() };

            bus.Subscribe(fakeHandler);
            await bus.Publish(events, CancellationToken.None);

            foreach (var @event in events)
            {
                var e = @event as EventA;
                Assert.True(e.Called);
            }
        }