示例#1
0
        public void Enable_Disable()
        {
            var tracer = new TestTracer();

            Assert.False(tracer.IsEnabled("TestEvent"));
            tracer.Enable("TestEvent");
            Assert.True(tracer.IsEnabled("TestEvent"));
            tracer.Disable("TestEvent");
            Assert.False(tracer.IsEnabled("TestEvent"));
        }
        public void Ctor_SpecifySubscriptions()
        {
            var tracer = new TestTracer(new string[] { DiagnosticEventKeys.RequestStart, DiagnosticEventKeys.RequestSuccess });

            Assert.True(tracer.IsEnabled(DiagnosticEventKeys.RequestStart));
            Assert.True(tracer.IsEnabled(DiagnosticEventKeys.RequestSuccess));

            // Others shouldn't be enabled.
            Assert.False(tracer.IsEnabled(DiagnosticEventKeys.RequestFailure));
            Assert.False(tracer.IsEnabled(DiagnosticEventKeys.MiddlewareFailure));
        }
示例#3
0
        public void EnableAll_SubscribesToAllEvents(string key)
        {
            var tracer = new TestTracer();

            tracer.EnableAll();
            Assert.True(tracer.IsEnabled(key));
        }
        public void Ctor_DefaultSubscribesToAllEvents(string key)
        {
            var tracer = new TestTracer();

            Assert.True(tracer.IsEnabled(key));
        }
示例#5
0
        public void IsEnabled_NotSubscribedByDefault(string key)
        {
            var tracer = new TestTracer();

            Assert.False(tracer.IsEnabled(key));
        }