コード例 #1
0
        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();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 public async Task DoesNotThrowForCorrectDiagnosticScope()
 {
     InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient());
     await client.CorrectScopeAsync();
 }
コード例 #7
0
 public async Task DoesNotThrowForForwardedDiagnosticScope()
 {
     InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient());
     await client.ForwardsAsync();
 }
コード例 #8
0
 public async Task DoesNotThrowWhenDuplicateDiagnosticScopeProperlyDisposed()
 {
     InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient());
     await client.DuplicateScopeProperlyDisposedAsync();
 }
コード例 #9
0
 public async Task DoesNotThrowForForwardedDiagnosticScopeContainingCorrectScopeAndAzureCoreScope()
 {
     InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient());
     await client.ForwardsAsync(true);
 }