< Summary

Class:KeyVault.TestFramework.SoftDeleteErrorDetectionStrategy
Assembly:Microsoft.Azure.KeyVault.TestFramework
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\tests\TestFramework\SoftDeleteErrorDetectionStrategy.cs
Covered lines:5
Uncovered lines:1
Coverable lines:6
Total lines:34
Line coverage:83.3% (5 of 6)
Covered branches:5
Total branches:8
Branch coverage:62.5% (5 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
IsTransient(...)-83.33%62.5%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\tests\TestFramework\SoftDeleteErrorDetectionStrategy.cs

#LineLine coverage
 1using Microsoft.Azure.KeyVault.Models;
 2using Microsoft.Rest.TransientFaultHandling;
 3using System;
 4using System.Net;
 5
 6namespace KeyVault.TestFramework
 7{
 8    /// <summary>
 9    /// A retry strategy that will wait until keys/secrets have been deleted or purged entirely.
 10    /// Since this is a long running operation that is not guaranteed to complete immediately.
 11    /// </summary>
 12    public class SoftDeleteErrorDetectionStrategy : ITransientErrorDetectionStrategy
 13    {
 14        public bool IsTransient(Exception ex)
 15        {
 15416            if (ex != null)
 17            {
 18                // Key vault will use this error type for all exceptions.
 19                KeyVaultErrorException kvException;
 15420                if((kvException = ex as KeyVaultErrorException) != null)
 21                {
 22                    // Retry on not found and conflict while object is in transitioning state.
 15423                    if (kvException.Response.StatusCode == HttpStatusCode.NotFound ||
 15424                        kvException.Response.StatusCode == HttpStatusCode.Conflict)
 25                    {
 15426                        return true;
 27                    }
 28                }
 29            }
 030            return false;
 31
 32        }
 33    }
 34}

Methods/Properties

IsTransient(...)