diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificateClientLiveTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificateClientLiveTests.cs index a30c88351974..9b28e1a6a52b 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificateClientLiveTests.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificateClientLiveTests.cs @@ -101,7 +101,9 @@ public async Task VerifyCancelCertificateOperation() Assert.Inconclusive("The create operation completed before it could be canceled."); } - OperationCanceledException ex = Assert.ThrowsAsync(() => WaitForCompletion(operation)); + OperationCanceledException ex = Assert.ThrowsAsync( + () => WaitForCompletion(operation), + $"Expected exception {nameof(OperationCanceledException)} not thrown. Operation status: {operation?.Properties?.Status}, error: {operation?.Properties?.Error?.Message}"); Assert.AreEqual("The operation was canceled so no value is available.", ex.Message); Assert.IsTrue(operation.HasCompleted); @@ -130,7 +132,9 @@ public async Task VerifyUnexpectedCancelCertificateOperation() Assert.Inconclusive("The create operation completed before it could be canceled."); } - OperationCanceledException ex = Assert.ThrowsAsync(() => WaitForCompletion(operation)); + OperationCanceledException ex = Assert.ThrowsAsync( + () => WaitForCompletion(operation), + $"Expected exception {nameof(OperationCanceledException)} not thrown. Operation status: {operation?.Properties?.Status}, error: {operation?.Properties?.Error?.Message}"); Assert.AreEqual("The operation was canceled so no value is available.", ex.Message); Assert.IsTrue(operation.HasCompleted);