コード例 #1
0
        public void GetTracerFromTraceManagerWithInstrumentationEnabled()
        {
            MockTraceListener.Reset();

            LogSource source = new LogSource("tracesource", SourceLevels.All);
            source.Listeners.Add(new MockTraceListener());

            List<LogSource> traceSources = new List<LogSource>(new LogSource[] { source });
            LogWriter lg = new LogWriterImpl(new List<ILogFilter>(), new List<LogSource>(), source, null, new LogSource("errors"), "default", true, false);

            TracerInstrumentationProvider instrumentationProvider = new TracerInstrumentationProvider(true, false, "applicationname");
            TraceManager tm = new TraceManager(lg, instrumentationProvider);

            Assert.IsNotNull(tm);

            using (tm.StartTrace("testoperation"))
            {
                Assert.AreEqual(1, MockTraceListener.Entries.Count);
            }

            Assert.AreEqual(2, MockTraceListener.Entries.Count);
        }
コード例 #2
0
        public void GetTracerFromTraceManagerWithInstrumentationEnabled()
        {
            MockTraceListener.Reset();

            LogSource source = new LogSource("tracesource", SourceLevels.All);

            source.Listeners.Add(new MockTraceListener());

            List <LogSource> traceSources = new List <LogSource>(new LogSource[] { source });
            LogWriter        lg           = new LogWriterImpl(new List <ILogFilter>(), new List <LogSource>(), source, null, new LogSource("errors"), "default", true, false);

            TracerInstrumentationProvider instrumentationProvider = new TracerInstrumentationProvider(true, false, "applicationname");
            TraceManager tm = new TraceManager(lg, instrumentationProvider);

            Assert.IsNotNull(tm);

            using (tm.StartTrace("testoperation"))
            {
                Assert.AreEqual(1, MockTraceListener.Entries.Count);
            }

            Assert.AreEqual(2, MockTraceListener.Entries.Count);
        }