/// <summary>
        /// Registers an expected exception to be thrown.
        /// </summary>
        /// <param name="secretName">The name of the secret associated with the exception.</param>
        /// <param name="ex">The exception to throw.</param>
        /// <returns>True if registered successfully, false if failed.</returns>
        public bool RegisterExpectedException(string secretName, SecretStoreException ex)
        {
            if (_expectedExceptions.ContainsKey(secretName))
            {
                throw new InvalidOperationException($"An exception for the secret with the identifier {secretName} was already registered!");
            }

            return(_expectedExceptions.TryAdd(secretName, ex));
        }
        public async Task GivenKeyVaultSecretStore_WhenDeletingSecretThrowsKeyVaultErrorExceptionWithNoResponse_ThenExceptionWillBeThrownWithInternalServerErrorStatusCode()
        {
            _retryCount  = 0;
            _secretStore = GetSecretStore(_retryCount);
            KeyVaultErrorException exception = new KeyVaultErrorException();

            _kvClient.DeleteSecretWithHttpMessagesAsync(_keyVaultUri.AbsoluteUri, SecretName, customHeaders: null, _cancellationToken)
            .Returns <AzureOperationResponse <DeletedSecretBundle> >(
                _ => throw exception);

            SecretStoreException sse = await Assert.ThrowsAsync <SecretStoreException>(() => _secretStore.DeleteSecretAsync(SecretName, _cancellationToken));

            Assert.NotNull(sse);
            Assert.Equal(HttpStatusCode.InternalServerError, sse.ResponseStatusCode);
        }
        public async Task GivenKeyVaultSecretStore_WhenSettingSecretThrowsKeyVaultErrorException_ThenExceptionWillBeThrownWithAppropriateStatusCode(HttpStatusCode keyVaultStatusCode, HttpStatusCode expectedStatusCode)
        {
            _retryCount  = 0;
            _secretStore = GetSecretStore(_retryCount);
            KeyVaultErrorException exception = GetKeyVaultError(keyVaultStatusCode);

            _kvClient.SetSecretWithHttpMessagesAsync(_keyVaultUri.AbsoluteUri, SecretName, SecretValue, tags: null, contentType: null, secretAttributes: null, customHeaders: null, _cancellationToken)
            .Returns <AzureOperationResponse <SecretBundle> >(
                _ => throw exception);

            SecretStoreException sse = await Assert.ThrowsAsync <SecretStoreException>(() => _secretStore.SetSecretAsync(SecretName, SecretValue, _cancellationToken));

            Assert.NotNull(sse);
            Assert.Equal(expectedStatusCode, sse.ResponseStatusCode);
        }