コード例 #1
0
        public void CreateLogger_DuplicateCategoryName_ReturnsTheSameLogger(string category)
        {
            var httpContextAccessorMock = new Mock <IHttpContextAccessor>();
            var optionsMock             = new PipaslotLoggerOptionsMock();
            var sut = new PipaslotLoggerProvider(httpContextAccessorMock.Object, new Pipe[0], optionsMock.Object);

            var logger1 = sut.CreateLogger(category);
            var logger2 = sut.CreateLogger(category);

            Assert.AreSame(logger1, logger2);
        }
コード例 #2
0
        private PipaslotLogger CreateLogger(string defaultTraceIdentifier = "Request123")
        {
            var httpContextAccessor = new HttpContextAccessor
            {
                HttpContext = new DefaultHttpContext()
                {
                    TraceIdentifier = defaultTraceIdentifier
                }
            };
            var options = new PipaslotLoggerOptionsMock();
            var pipes   = new[]
            {
                new Pipe(_writerMock.Object, new NullFilter())
            };

            _aggregator = new QueueAggregator(pipes, options.Object);
            return(new PipaslotLogger(httpContextAccessor, _aggregator, "category"));
        }