Esempio n. 1
0
        public void CallsToOpMarkedWithOperationTelemetryGeneratesEvents()
        {
            TestTelemetryChannel.Clear();
            var host = new HostingContext <SelectiveTelemetryService, ISelectiveTelemetryService>();

            using ( host )
            {
                host.Open();

                ISelectiveTelemetryService client = host.GetChannel();
                client.OperationWithTelemetry();
            }
            Assert.IsTrue(TestTelemetryChannel.CollectedData().Count > 0);
        }
Esempio n. 2
0
        public void CallCanFlowRootOperationId()
        {
            TestTelemetryChannel.Clear();
            var host = new HostingContext <SelectiveTelemetryService, ISelectiveTelemetryService>();

            using ( host )
            {
                host.Open();

                ISelectiveTelemetryService client = host.GetChannel();
                using (var scope = new OperationContextScope((IContextChannel)client))
                {
                    var rootId = new RootIdMessageHeader();
                    rootId.RootId = "rootId";
                    OperationContext.Current.OutgoingMessageHeaders.Add(rootId);
                    client.OperationWithTelemetry();
                }
            }
            Assert.AreEqual("rootId", TestTelemetryChannel.CollectedData().First().Context.Operation.Id);
        }