Beispiel #1
0
        public void EventSourceFakeUnknownEventWithNullPayloadTest()
        {
            using FakeMisbehavingSqlEventSource fakeSqlEventSource = new FakeMisbehavingSqlEventSource();

            var activityProcessor = new Mock <ActivityProcessor>();

            using var shutdownSignal = OpenTelemetrySdk.CreateTracerProvider(b =>
            {
                b.AddProcessorPipeline(c => c.AddProcessor(ap => activityProcessor.Object));
                b.AddSqlClientDependencyInstrumentation();
            });

            fakeSqlEventSource.WriteUnknownEventWithNullPayload();

            Assert.Equal(0, activityProcessor.Invocations.Count);
        }
        public void EventSourceFakeUnknownEventWithNullPayloadTest()
        {
            using FakeMisbehavingSqlEventSource fakeSqlEventSource = new FakeMisbehavingSqlEventSource();

            var activityProcessor = new Mock <ActivityProcessor>();

            using var shutdownSignal = Sdk.CreateTracerProviderBuilder()
                                       .AddProcessor(activityProcessor.Object)
                                       .AddSqlClientInstrumentation()
                                       .Build();

            fakeSqlEventSource.WriteUnknownEventWithNullPayload();

            shutdownSignal.Dispose();

            Assert.Equal(2, activityProcessor.Invocations.Count); // OnShutdown/Dispose called.
        }