Exemple #1
0
        /// <summary>
        /// Initializes a new instance of a RestoreOperation for mocking purposes.
        /// </summary>
        /// <param name="value">The response value that will be used to populate various properties.</param>
        /// <param name="response">The <see cref="Response" /> that will be returned from <see cref="GetRawResponse" />.</param>
        /// <param name="client">An instance of <see cref="KeyVaultBackupClient" />.</param>
        /// <exception cref="ArgumentNullException"><paramref name="value"/> or <paramref name="response"/> or <paramref name="client"/> is null.</exception>
        internal RestoreOperationInternal(TResponseType value, Response response, KeyVaultBackupClient client)
        {
            Argument.AssertNotNull(value, nameof(value));
            Argument.AssertNotNull(response, nameof(response));
            Argument.AssertNotNull(client, nameof(client));

            _client   = client;
            _response = response;
            _value    = value;
            _id       = value switch
            {
                SelectiveKeyRestoreDetailsInternal r => r.JobId,
                RestoreDetailsInternal r => r.JobId,
                                                   null => default,
        public void Setup()
        {
            DateTimeOffset now = DateTimeOffset.Now;

            failedRestore = new SelectiveKeyRestoreDetailsInternal(
                "failed",
                "failure details",
                new KeyVaultServiceError("500", "failed restore", null),
                JobId,
                DateTimeOffset.Now.AddMinutes(-5),
                now);
            incompleteRestore = new SelectiveKeyRestoreDetailsInternal(
                "in progress",
                "",
                null,
                JobId,
                DateTimeOffset.Now.AddMinutes(-5),
                null);

            failedResponse = new Mock <Response <SelectiveKeyRestoreDetailsInternal> >();
            failedResponse.SetupGet(m => m.Value).Returns(failedRestore);
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of a SelectiveKeyRestoreOperation for mocking purposes.
 /// </summary>
 /// <param name="value">The <see cref="SelectiveKeyRestoreDetailsInternal" /> that will be used to populate various properties.</param>
 /// <param name="response">The <see cref="Response" /> that will be returned from <see cref="GetRawResponse" />.</param>
 /// <param name="client">An instance of <see cref="KeyVaultBackupClient" />.</param>
 /// <exception cref="ArgumentNullException"><paramref name="value"/> or <paramref name="response"/> or <paramref name="client"/> is null.</exception>
 internal SelectiveKeyRestoreOperation(SelectiveKeyRestoreDetailsInternal value, Response response, KeyVaultBackupClient client)
 {
     _operationInternal = new RestoreOperationInternal <AzureSecurityKeyVaultAdministrationSelectiveKeyRestoreOperationHeaders, SelectiveKeyRestoreResult, SelectiveKeyRestoreDetailsInternal>(value, response, client);
 }