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); }
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); }
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); }