< Summary

Class:Azure.Security.KeyVault.Secrets.SecretModelFactory
Assembly:Azure.Security.KeyVault.Secrets
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Secrets\src\SecretModelFactory.cs
Covered lines:0
Uncovered lines:35
Coverable lines:35
Total lines:118
Line coverage:0% (0 of 35)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
SecretProperties(...)-0%100%
SecretProperties(...)-0%100%
KeyVaultSecret(...)-0%100%
DeletedSecret(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Secrets\src\SecretModelFactory.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.ComponentModel;
 6
 7namespace Azure.Security.KeyVault.Secrets
 8{
 9    /// <summary>
 10    /// Model factory that enables mocking for the Key Vault Secrets library.
 11    /// </summary>
 12    public static class SecretModelFactory
 13    {
 14        /// <summary>
 15        /// Initializes a new instance of the <see cref="Secrets.SecretProperties"/> for mocking purposes.
 16        /// </summary>
 17        /// <param name="id">Sets the <see cref="Secrets.SecretProperties.Id"/> property.</param>
 18        /// <param name="vaultUri">Sets the <see cref="Secrets.SecretProperties.VaultUri"/> property.</param>
 19        /// <param name="name">Sets the <see cref="Secrets.SecretProperties.Name"/> property.</param>
 20        /// <param name="version">Sets the <see cref="Secrets.SecretProperties.Version"/> property.</param>
 21        /// <param name="managed">Sets the <see cref="Secrets.SecretProperties.Managed"/> property.</param>
 22        /// <param name="keyId">Sets the <see cref="Secrets.SecretProperties.KeyId"/> property.</param>
 23        /// <param name="createdOn">Sets the <see cref="Secrets.SecretProperties.CreatedOn"/> property.</param>
 24        /// <param name="updatedOn">Sets the <see cref="Secrets.SecretProperties.UpdatedOn"/> property.</param>
 25        /// <param name="recoveryLevel">Sets the <see cref="Secrets.SecretProperties.RecoveryLevel"/> property.</param>
 26        /// <returns>A new instance of the <see cref="Secrets.SecretProperties"/> for mocking purposes.</returns>
 27        [EditorBrowsable(EditorBrowsableState.Never)]
 28        public static SecretProperties SecretProperties(
 29            Uri id,
 30            Uri vaultUri,
 31            string name,
 32            string version,
 33            bool managed,
 34            Uri keyId,
 35            DateTimeOffset? createdOn,
 36            DateTimeOffset? updatedOn,
 037            string recoveryLevel) => SecretProperties(
 038                id,
 039                vaultUri,
 040                name,
 041                version,
 042                managed,
 043                keyId,
 044                createdOn,
 045                updatedOn,
 046                recoveryLevel,
 047                default);
 48
 49        /// <summary>
 50        /// Initializes a new instance of the <see cref="Secrets.SecretProperties"/> for mocking purposes.
 51        /// </summary>
 52        /// <param name="id">Sets the <see cref="Secrets.SecretProperties.Id"/> property.</param>
 53        /// <param name="vaultUri">Sets the <see cref="Secrets.SecretProperties.VaultUri"/> property.</param>
 54        /// <param name="name">Sets the <see cref="Secrets.SecretProperties.Name"/> property.</param>
 55        /// <param name="version">Sets the <see cref="Secrets.SecretProperties.Version"/> property.</param>
 56        /// <param name="managed">Sets the <see cref="Secrets.SecretProperties.Managed"/> property.</param>
 57        /// <param name="keyId">Sets the <see cref="Secrets.SecretProperties.KeyId"/> property.</param>
 58        /// <param name="createdOn">Sets the <see cref="Secrets.SecretProperties.CreatedOn"/> property.</param>
 59        /// <param name="updatedOn">Sets the <see cref="Secrets.SecretProperties.UpdatedOn"/> property.</param>
 60        /// <param name="recoveryLevel">Sets the <see cref="Secrets.SecretProperties.RecoveryLevel"/> property.</param>
 61        /// <param name="recoverableDays">Sets the <see cref="Secrets.SecretProperties.RecoverableDays"/> property.</par
 62        /// <returns>A new instance of the <see cref="Secrets.SecretProperties"/> for mocking purposes.</returns>
 63        public static SecretProperties SecretProperties(
 64            Uri id = default,
 65            Uri vaultUri = default,
 66            string name = default,
 67            string version = default,
 68            bool managed = default,
 69            Uri keyId = default,
 70            DateTimeOffset? createdOn = default,
 71            DateTimeOffset? updatedOn = default,
 72            string recoveryLevel = default,
 73            int? recoverableDays = default)
 74        {
 075            return new SecretProperties
 076            {
 077                Id = id,
 078                VaultUri = vaultUri,
 079                Name = name,
 080                Version = version,
 081                Managed = managed,
 082                KeyId = keyId,
 083                CreatedOn = createdOn,
 084                UpdatedOn = updatedOn,
 085                RecoveryLevel = recoveryLevel,
 086                RecoverableDays = recoverableDays,
 087            };
 88        }
 89
 90        /// <summary>
 91        /// Initializes a new instance of the <see cref="Secrets.KeyVaultSecret"/> for mocking purposes.
 92        /// </summary>
 93        /// <param name="properties">Sets the <see cref="Secrets.KeyVaultSecret.Properties"/> property, which provides t
 94        /// <param name="value">Sets the <see cref="Secrets.KeyVaultSecret.Value"/> property.</param>
 95        /// <returns>A new instance of the <see cref="Secrets.KeyVaultSecret"/> for mocking purposes.</returns>
 096        public static KeyVaultSecret KeyVaultSecret(SecretProperties properties, string value = default) => new KeyVault
 097        {
 098            Value = value,
 099        };
 100
 101        /// <summary>
 102        /// Initializes a new instance of the <see cref="Secrets.DeletedSecret"/> for mocking purposes.
 103        /// </summary>
 104        /// <param name="properties">Sets the <see cref="Secrets.KeyVaultSecret.Properties"/> property, which provides t
 105        /// <param name="value">Sets the <see cref="Secrets.KeyVaultSecret.Value"/> property.</param>
 106        /// <param name="recoveryId">Sets the <see cref="Secrets.DeletedSecret.RecoveryId"/> property.</param>
 107        /// <param name="deletedOn">Sets the <see cref="Secrets.DeletedSecret.DeletedOn"/> property.</param>
 108        /// <param name="scheduledPurgeDate">Sets the <see cref="Secrets.DeletedSecret.ScheduledPurgeDate"/> property.</
 109        /// <returns>A new instance of the <see cref="Secrets.DeletedSecret"/> for mocking purposes.</returns>
 0110        public static DeletedSecret DeletedSecret(SecretProperties properties, string value = default, Uri recoveryId = 
 0111        {
 0112            Value = value,
 0113            RecoveryId = recoveryId,
 0114            DeletedOn = deletedOn,
 0115            ScheduledPurgeDate = scheduledPurgeDate,
 0116        };
 117    }
 118}