示例#1
0
        public async Task ShouldRetryEventThreeTimes()
        {
            var args = new FakeRetryEventArgs(2);

            await _bus.PublishAsync(args);

            Assert.Equal(4, args.NumberOfAttemptsToHandle);
        }
        public async Task ShouldPublishEventToAllHandlers()
        {
            var args = new FakeEventArgs();
            await _bus.PublishAsync(args);

            Assert.Equal(2, args.TimesHandled);
        }
        public async Task ShouldUseRetryAndLoggingEventDecorators()
        {
            var args = new FakeRetryEventArgs(2);
            await _bus.PublishAsync(args);

            Assert.Equal(4, args.NumberOfAttemptsToHandle);
            Assert.Equal(6, _logger.GetMessages(LogLevel.Information).Length);
        }
        public async Task ShouldLogInfoWhenPublishingEvent()
        {
            var args = new FakeEventArgs();

            await _bus.PublishAsync(args);

            Assert.Equal(2, args.TimesHandled);
            Assert.Equal(4, _logger.GetMessages(LogLevel.Information).Length);
        }