public async Task DoesNotThrowForCorrectPageableScopes() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); Assert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, await client.GetPageableValidScopesAsync().ToEnumerableAsync()); await client.ForwardsAsync(); }
public void ThrowsWhenNoDiagnosticScope() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); InvalidOperationException ex = Assert.ThrowsAsync <InvalidOperationException>(async() => await client.NoScopeAsync()); StringAssert.Contains("Expected some diagnostic event to fire", ex.Message); }
public void ThrowsWhenDuplicateDiagnosticScope_Ancestor() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); InvalidOperationException ex = Assert.ThrowsAsync <InvalidOperationException>(async() => await client.DuplicateScopeAncestorAsync()); StringAssert.Contains($"A scope has already started for event '{typeof(InvalidDiagnosticScopeTestClient).Name}.{nameof(client.DuplicateScopeAncestor)}'", ex.Message); }
public void ThrowsWhenOnlyAzureCoreDiagnosticScopesPresent() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); InvalidOperationException ex = Assert.ThrowsAsync <InvalidOperationException>(async() => await client.AzureCoreScopeAsync()); StringAssert.Contains("Expected some diagnostic scopes to be created other than the Azure.Core scopes", ex.Message); }
public void ThrowsWhenWrongDiagnosticScope() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); InvalidOperationException ex = Assert.ThrowsAsync <InvalidOperationException>(async() => await client.WrongScopeAsync()); // Make the error message more helpful StringAssert.Contains($"{typeof(InvalidDiagnosticScopeTestClient).Name}.{nameof(client.WrongScope)}", ex.Message); StringAssert.Contains("ForwardsClientCalls", ex.Message); StringAssert.Contains("operationId", ex.Message); }
public async Task DoesNotThrowForCorrectDiagnosticScope() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); await client.CorrectScopeAsync(); }
public async Task DoesNotThrowForForwardedDiagnosticScope() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); await client.ForwardsAsync(); }
public async Task DoesNotThrowWhenDuplicateDiagnosticScopeProperlyDisposed() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); await client.DuplicateScopeProperlyDisposedAsync(); }
public async Task DoesNotThrowForForwardedDiagnosticScopeContainingCorrectScopeAndAzureCoreScope() { InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient()); await client.ForwardsAsync(true); }