< Summary

Class:Azure.Security.KeyVault.Keys.CryptographyModelFactory
Assembly:Azure.Security.KeyVault.Keys
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\CryptographyModelFactory.cs
Covered lines:0
Uncovered lines:36
Coverable lines:36
Total lines:97
Line coverage:0% (0 of 36)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
DecryptResult(...)-0%100%
EncryptResult(...)-0%100%
SignResult(...)-0%100%
UnwrapResult(...)-0%100%
VerifyResult(...)-0%100%
WrapResult(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\CryptographyModelFactory.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using Azure.Security.KeyVault.Keys.Cryptography;
 5
 6namespace Azure.Security.KeyVault.Keys
 7{
 8    /// <summary>
 9    /// Model factory that enables mocking for the Key Vault Cryptography library.
 10    /// </summary>
 11    public static class CryptographyModelFactory
 12    {
 13        /// <summary>
 14        /// Initializes a new instance of the <see cref="Cryptography.DecryptResult"/> for mocking purposes.
 15        /// </summary>
 16        /// <param name="keyId">Sets the <see cref="DecryptResult.KeyId"/> property.</param>
 17        /// <param name="plaintext">Sets the <see cref="DecryptResult.Plaintext"/> property.</param>
 18        /// <param name="algorithm">Sets the <see cref="DecryptResult.Algorithm"/> property.</param>
 19        /// <returns>A new instance of the <see cref="Cryptography.DecryptResult"/> for mocking purposes.</returns>
 020        public static DecryptResult DecryptResult(string keyId = default, byte[] plaintext = default, EncryptionAlgorith
 021        {
 022            KeyId = keyId,
 023            Plaintext = plaintext,
 024            Algorithm = algorithm,
 025        };
 26
 27        /// <summary>
 28        /// Initializes a new instance of the <see cref="Cryptography.EncryptResult"/> for mocking purposes.
 29        /// </summary>
 30        /// <param name="keyId">Sets the <see cref="EncryptResult.KeyId"/> property.</param>
 31        /// <param name="ciphertext">Sets the <see cref="EncryptResult.Ciphertext"/> property.</param>
 32        /// <param name="algorithm">Sets the <see cref="EncryptResult.Algorithm"/> property.</param>
 33        /// <returns>A new instance of the <see cref="Cryptography.EncryptResult"/> for mocking purposes.</returns>
 034        public static EncryptResult EncryptResult(string keyId = default, byte[] ciphertext = default, EncryptionAlgorit
 035        {
 036            KeyId = keyId,
 037            Ciphertext = ciphertext,
 038            Algorithm = algorithm,
 039        };
 40
 41        /// <summary>
 42        /// Initializes a new instance of the <see cref="Cryptography.SignResult"/> for mocking purposes.
 43        /// </summary>
 44        /// <param name="keyId">Sets the <see cref="SignResult.KeyId"/> property.</param>
 45        /// <param name="signature">Sets the <see cref="SignResult.Signature"/> property.</param>
 46        /// <param name="algorithm">Sets the <see cref="SignResult.Algorithm"/> property.</param>
 47        /// <returns>A new instance of the <see cref="Cryptography.SignResult"/> for mocking purposes.</returns>
 048        public static SignResult SignResult(string keyId = default, byte[] signature = default, SignatureAlgorithm algor
 049        {
 050            KeyId = keyId,
 051            Signature = signature,
 052            Algorithm = algorithm,
 053        };
 54
 55        /// <summary>
 56        /// Initializes a new instance of the <see cref="Cryptography.UnwrapResult"/> for mocking purposes.
 57        /// </summary>
 58        /// <param name="keyId">Sets the <see cref="UnwrapResult.KeyId"/> property.</param>
 59        /// <param name="key">Sets the <see cref="UnwrapResult.Key"/> property.</param>
 60        /// <param name="algorithm">Sets the <see cref="UnwrapResult.Algorithm"/> property.</param>
 61        /// <returns>A new instance of the <see cref="Cryptography.UnwrapResult"/> for mocking purposes.</returns>
 062        public static UnwrapResult UnwrapResult(string keyId = default, byte[] key = default, KeyWrapAlgorithm algorithm
 063        {
 064            KeyId = keyId,
 065            Key = key,
 066            Algorithm = algorithm,
 067        };
 68
 69        /// <summary>
 70        /// Initializes a new instance of the <see cref="Cryptography.VerifyResult"/> for mocking purposes.
 71        /// </summary>
 72        /// <param name="keyId">Sets the <see cref="VerifyResult.KeyId"/> property.</param>
 73        /// <param name="isValid">Sets the <see cref="VerifyResult.IsValid"/> property.</param>
 74        /// <param name="algorithm">Sets the <see cref="VerifyResult.Algorithm"/> property.</param>
 75        /// <returns>A new instance of the <see cref="Cryptography.VerifyResult"/> for mocking purposes.</returns>
 076        public static VerifyResult VerifyResult(string keyId = default, bool isValid = default, SignatureAlgorithm algor
 077        {
 078            KeyId = keyId,
 079            IsValid = isValid,
 080            Algorithm = algorithm,
 081        };
 82
 83        /// <summary>
 84        /// Initializes a new instance of the <see cref="Cryptography.WrapResult"/> for mocking purposes.
 85        /// </summary>
 86        /// <param name="keyId">Sets the <see cref="WrapResult.KeyId"/> property.</param>
 87        /// <param name="key">Sets the <see cref="WrapResult.EncryptedKey"/> property.</param>
 88        /// <param name="algorithm">Sets the <see cref="WrapResult.Algorithm"/> property.</param>
 89        /// <returns>A new instance of the <see cref="Cryptography.WrapResult"/> for mocking purposes.</returns>
 090        public static WrapResult WrapResult(string keyId = default, byte[] key = default, KeyWrapAlgorithm algorithm = d
 091        {
 092            KeyId = keyId,
 093            EncryptedKey = key,
 094            Algorithm = algorithm,
 095        };
 96    }
 97}