public void Unsubscribe_SHOULD_SUCCESS() { var logger = NullLogger <MemoryEventBus> .Instance; var bus = new MemoryEventBus(logger); var fakeHandler = new EventAHandler(); bus.Unsubscribe(fakeHandler); }
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(); }
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); }
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); }
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); } }