Пример #1
0
        public void UseLocalScopeLogsMessageWithScope()
        {
            // Arrange
            var loggerFactory = TestLoggerFactory.Create();
            var sampleLogger  = loggerFactory.CreateLogger <Sample>();
            var moreLogger    = loggerFactory.CreateLogger <More>();
            var more          = new More(new Sample(sampleLogger), moreLogger);

            // Act
            more.UseLocalScope();

            // Assert
            var log = Assert.Single(loggerFactory.Sink.LogEntries);

            Assert.Equal("This scope's answer is 42", log.Scope.Message);
        }