< Summary

Class:Microsoft.Azure.KeyVault.Models.KeyOperationsParameters
Assembly:Microsoft.Azure.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\src\Generated\Models\KeyOperationsParameters.cs
Covered lines:4
Uncovered lines:12
Coverable lines:16
Total lines:86
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\KeyOperationsParameters.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 KeyOperationsParameters
 22    {
 23        /// <summary>
 24        /// Initializes a new instance of the KeyOperationsParameters class.
 25        /// </summary>
 3226        public KeyOperationsParameters()
 27        {
 28            CustomInit();
 3229        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the KeyOperationsParameters class.
 33        /// </summary>
 34        /// <param name="algorithm">algorithm identifier. Possible values
 35        /// include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'</param>
 036        public KeyOperationsParameters(string algorithm, byte[] value)
 37        {
 038            Algorithm = algorithm;
 039            Value = value;
 40            CustomInit();
 041        }
 42
 43        /// <summary>
 44        /// An initialization method that performs custom operations like setting defaults
 45        /// </summary>
 46        partial void CustomInit();
 47
 48        /// <summary>
 49        /// Gets or sets algorithm identifier. Possible values include:
 50        /// 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'
 51        /// </summary>
 52        [JsonProperty(PropertyName = "alg")]
 6453        public string Algorithm { get; set; }
 54
 55        /// <summary>
 56        /// </summary>
 57        [JsonConverter(typeof(Base64UrlJsonConverter))]
 58        [JsonProperty(PropertyName = "value")]
 6459        public byte[] Value { get; set; }
 60
 61        /// <summary>
 62        /// Validate the object.
 63        /// </summary>
 64        /// <exception cref="ValidationException">
 65        /// Thrown if validation fails
 66        /// </exception>
 67        public virtual void Validate()
 68        {
 069            if (Algorithm == null)
 70            {
 071                throw new ValidationException(ValidationRules.CannotBeNull, "Algorithm");
 72            }
 073            if (Value == null)
 74            {
 075                throw new ValidationException(ValidationRules.CannotBeNull, "Value");
 76            }
 077            if (Algorithm != null)
 78            {
 079                if (Algorithm.Length < 1)
 80                {
 081                    throw new ValidationException(ValidationRules.MinLength, "Algorithm", 1);
 82                }
 83            }
 084        }
 85    }
 86}