Beispiel #1
0
 public void Then_a_restart_warning_is_logged()
 {
     _loggerMock.Verify(
         LogLevel.Warning,
         $"Detected gap in the message stream for catching up projection. Aborted projection {_projection.Id} and queued restart in {_gapStrategySettings.RetryDelayInSeconds} seconds.",
         Times.Once);
 }
Beispiel #2
0
 public void Then_a_missing_stream_messages_warning_is_logged()
 {
     _loggerMock.Verify(
         LogLevel.Warning,
         $"Expected messages at positions [{string.Join(", ", _missingPositions)}] were not processed for {_projection}.",
         Times.Once);
 }
 public void ThenAWarningIsLoggedForEachRetry()
 {
     for (var i = 1; i <= _numberOfRetries; i++)
     {
         _loggerMock.Verify(
             LogLevel.Warning,
             $"Projection '{_projection}' failed. Retry attempt #{i} in {_initialWait.Multiply(i).TotalSeconds} seconds.",
             Times.Once);
     }
 }
Beispiel #4
0
 public async Task Then_no_missing_stream_messages_warning_is_logged()
 {
     try
     {
         await _handlingMessage();
     }
     catch { }
     finally
     {
         _loggerMock.Verify(
             LogLevel.Warning,
             $"Expected messages at positions [{string.Join(", ", _missingPositions)}] were not processed for {_projection}.",
             Times.Never);
     }
 }
        public async Task ThenAWarningIsLoggedForEachRetry()
        {
            try
            {
                await Act();
            }
            catch (RetryException)
            { }

            for (var i = 1; i <= _numberOfRetries; i++)
            {
                _loggerMock.Verify(
                    LogLevel.Warning,
                    $"Projection '{_projection}' failed. Retry attempt #{i} in {_initialWait.Multiply(i).TotalSeconds} seconds.",
                    Times.Once);
            }
        }
        public async Task ThenAWarningIsLoggedForEachRetry()
        {
            try
            {
                await Act();
            }
            catch (DoNotRetryException)
            { }

            foreach (var attempt in _exceptionSequence.Select((exception, i) => new { Error = exception, Retry = i + 1 }))
            {
                if (attempt.Error is DoNotRetryException)
                {
                    break;
                }

                _loggerMock.Verify(
                    LogLevel.Warning,
                    $"Projection '{_projection}' failed. Retry attempt #{attempt.Retry} in {_initialWait.Multiply(attempt.Retry).TotalSeconds} seconds.",
                    Times.Once);
            }
        }
 private void VerifyHandleIsLogged <TCommand>(TCommand command, Func <Times> times)
     where TCommand : ConnectedProjectionCommand
 => _handlerLoggerMock.Verify(LogLevel.Trace, $"Handling {command}", times);