public static void VerifyDependency(TelemetryItem telemetryItem, ExpectedTelemetryItemValues expectedVars) { Assert.Equal("RemoteDependency", telemetryItem.Name); Assert.Equal(nameof(RemoteDependencyData), telemetryItem.Data.BaseType); var data = (RemoteDependencyData)telemetryItem.Data.BaseData; Assert.Equal(expectedVars.Name, data.Name); Assert.Equal(expectedVars.CustomProperties, data.Properties); }
public static void VerifyEvent(TelemetryItem telemetryItem, ExpectedTelemetryItemValues expectedVars) { Assert.Equal("Message", telemetryItem.Name); Assert.Equal(nameof(MessageData), telemetryItem.Data.BaseType); var data = (MessageData)telemetryItem.Data.BaseData; Assert.Equal(expectedVars.Message, data.Message); Assert.Equal(expectedVars.SeverityLevel, data.SeverityLevel); Assert.Equal(expectedVars.SpanId, telemetryItem.Tags["ai.operation.parentId"]); Assert.Equal(expectedVars.TraceId, telemetryItem.Tags["ai.operation.id"]); }
public static void Verify(TelemetryItem telemetryItem, ActivityKind activityKind, ExpectedTelemetryItemValues expectedVars) { switch (activityKind) { case ActivityKind.Client: case ActivityKind.Producer: case ActivityKind.Internal: VerifyDependency(telemetryItem, expectedVars); break; case ActivityKind.Consumer: case ActivityKind.Server: VerifyRequest(telemetryItem, expectedVars); break; default: throw new Exception($"unknown ActivityKind '{activityKind}'"); } }