private static void ValidateTelemetryPacket( DependencyTelemetry remoteDependencyTelemetryActual, string name, RemoteDependencyKind kind, bool? success, bool async, int count, double valueMin, string statusCode) { Assert.AreEqual(name, remoteDependencyTelemetryActual.Name, true, "Resource name in the sent telemetry is wrong"); Assert.AreEqual(kind.ToString(), remoteDependencyTelemetryActual.DependencyKind, "DependencyKind in the sent telemetry is wrong"); Assert.AreEqual(success, remoteDependencyTelemetryActual.Success, "Success in the sent telemetry is wrong"); Assert.AreEqual(statusCode, remoteDependencyTelemetryActual.ResultCode, "ResultCode in the sent telemetry is wrong"); var valueMinRelaxed = valueMin - TimeAccuracyMilliseconds; Assert.IsTrue( remoteDependencyTelemetryActual.Duration >= TimeSpan.FromMilliseconds(valueMinRelaxed), string.Format(CultureInfo.InvariantCulture, "Value (dependency duration = {0}) in the sent telemetry should be equal or more than the time duration between start and end", remoteDependencyTelemetryActual.Duration)); var valueMax = valueMin + TimeAccuracyMilliseconds; Assert.IsTrue( remoteDependencyTelemetryActual.Duration <= TimeSpan.FromMilliseconds(valueMax), string.Format(CultureInfo.InvariantCulture, "Value (dependency duration = {0}) in the sent telemetry should not be signigficantly bigger then the time duration between start and end", remoteDependencyTelemetryActual.Duration)); }
private static void ValidateDependencyCallOperation(DependencyTelemetry operation, string name, RemoteDependencyKind type, string methodName) { Assert.IsNotNull(operation, "Operation returned should not be null for method:" + methodName); Assert.AreEqual(name, operation.Name, true, "Resource name in the returned operation is wrong for method:" + methodName); }