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

            using ( host )
            {
                host.Open();

                ISelectiveTelemetryService client = host.GetChannel();
                client.OperationWithoutTelemetry();
            }
            Assert.AreEqual(0, TestTelemetryChannel.CollectedData().Count);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }