Beispiel #1
0
        public async Task Async_Error_Log_Call_Shoould_Write_File_Expected_Message__And_Path()
        {
            string message         = LoggerProvider.CreateLogMessage(MessageLength.Normal);
            string expectedMessage = $"{_dateTimeProviderMock.UtcNow} [ERROR] {message}";

            using (var stream = _streamFactoryMock.Create())
            {
                var streamLogger = new StreamLogger(stream, _dateTimeProviderMock, _streamWriterMock);
                await streamLogger.LogAsync(LogLevel.Error, message);

                await _streamWriterMock.Received().WriteLineAsync(Arg.Any <Stream>(), Arg.Is(expectedMessage));
            }
        }