Пример #1
0
        public async Task Publish_Event_CriticalHandlerThrow_Should_NotCallNextHandlers()
        {
            var evt        = new CriticalEvent();
            var cfgBuilder =
                new InMemoryEventBusConfigurationBuilder();
            var bus = new InMemoryEventBus(cfgBuilder.Build());

            (await bus.PublishEventAsync(evt)).IsSuccess.Should().BeTrue();

            evt.HandlerData.Should().Be("AB");
        }
Пример #2
0
        public async Task Publish_Event_CriticalHandlerThrow_Should_BeTheOnlyOneRetried_If_RetryStrategy_IsDefined()
        {
            var evt        = new CriticalEvent();
            var cfgBuilder =
                new InMemoryEventBusConfigurationBuilder()
                .SetRetryStrategy(1, 3);
            var bus = new InMemoryEventBus(cfgBuilder.Build());

            (await bus.PublishEventAsync(evt)).IsSuccess.Should().BeTrue();

            evt.HandlerData.Should().Be("ABBBC");
            evt.NbTries.Should().Be(3);
        }