< Summary

Class:Microsoft.Azure.KeyVault.Models.KeySignParameters
Assembly:Microsoft.Azure.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\src\Generated\Models\KeySignParameters.cs
Covered lines:4
Uncovered lines:12
Coverable lines:16
Total lines:92
Line coverage:25% (4 of 16)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_Algorithm()-100%100%
get_Value()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\src\Generated\Models\KeySignParameters.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.KeyVault.Models
 12{
 13    using Microsoft.Rest;
 14    using Microsoft.Rest.Serialization;
 15    using Newtonsoft.Json;
 16    using System.Linq;
 17
 18    /// <summary>
 19    /// The key operations parameters.
 20    /// </summary>
 21    public partial class KeySignParameters
 22    {
 23        /// <summary>
 24        /// Initializes a new instance of the KeySignParameters class.
 25        /// </summary>
 2026        public KeySignParameters()
 27        {
 28            CustomInit();
 2029        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the KeySignParameters class.
 33        /// </summary>
 34        /// <param name="algorithm">The signing/verification algorithm
 35        /// identifier. For more information on possible algorithm types, see
 36        /// Microsoft.Azure.KeyVault.WebKey.JsonWebKeySignatureAlgorithm. Possible values include: 'PS256',
 37        /// 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256',
 38        /// 'ES384', 'ES512', 'ES256K'</param>
 039        public KeySignParameters(string algorithm, byte[] value)
 40        {
 041            Algorithm = algorithm;
 042            Value = value;
 43            CustomInit();
 044        }
 45
 46        /// <summary>
 47        /// An initialization method that performs custom operations like setting defaults
 48        /// </summary>
 49        partial void CustomInit();
 50
 51        /// <summary>
 52        /// Gets or sets the signing/verification algorithm identifier. For
 53        /// more information on possible algorithm types, see
 54        /// Microsoft.Azure.KeyVault.WebKey.JsonWebKeySignatureAlgorithm. Possible values include: 'PS256',
 55        /// 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256',
 56        /// 'ES384', 'ES512', 'ES256K'
 57        /// </summary>
 58        [JsonProperty(PropertyName = "alg")]
 4059        public string Algorithm { get; set; }
 60
 61        /// <summary>
 62        /// </summary>
 63        [JsonConverter(typeof(Base64UrlJsonConverter))]
 64        [JsonProperty(PropertyName = "value")]
 4065        public byte[] Value { get; set; }
 66
 67        /// <summary>
 68        /// Validate the object.
 69        /// </summary>
 70        /// <exception cref="ValidationException">
 71        /// Thrown if validation fails
 72        /// </exception>
 73        public virtual void Validate()
 74        {
 075            if (Algorithm == null)
 76            {
 077                throw new ValidationException(ValidationRules.CannotBeNull, "Algorithm");
 78            }
 079            if (Value == null)
 80            {
 081                throw new ValidationException(ValidationRules.CannotBeNull, "Value");
 82            }
 083            if (Algorithm != null)
 84            {
 085                if (Algorithm.Length < 1)
 86                {
 087                    throw new ValidationException(ValidationRules.MinLength, "Algorithm", 1);
 88                }
 89            }
 090        }
 91    }
 92}