예제 #1
0
        public void DoMoreLogsFormat_NotCheckingNested()
        {
            // Arrange
            var loggerFactory = TestLoggerFactory.Create(options => options.FilterByTypeName <More>());
            var sampleLogger  = loggerFactory.CreateLogger <Sample>();
            var moreLogger    = loggerFactory.CreateLogger <More>();
            var more          = new More(new Sample(sampleLogger), moreLogger);

            // Act
            more.DoMore();

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

            Assert.Equal("More is less.", log.OriginalFormat);
        }
예제 #2
0
        public void DoMoreLogsMessage()
        {
            // 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.DoMore();

            // Assert
            Assert.Collection(loggerFactory.Sink.LogEntries,
                              l => Assert.Equal("More is less.", l.Message),
                              l => Assert.Equal("The answer is 42", l.Message));
        }
예제 #3
0
파일: MoreTest.cs 프로젝트: alefranz/MELT
        public void DoMoreLogsMessage_NotCheckingNested()
        {
            // Arrange
            var loggerFactory = MELTBuilder.CreateLoggerFactory(options => options.FilterByTypeName <More>());
            var sampleLogger  = loggerFactory.CreateLogger <Sample>();
            var moreLogger    = loggerFactory.CreateLogger <More>();
            var more          = new More(new Sample(sampleLogger), moreLogger);

            // Act
            more.DoMore();

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

            Assert.Equal("More is less.", log.Message);
        }