< Summary

Class:Microsoft.Azure.Batch.CertificateReference
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\CertificateReference.cs
C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\CertificateReference.cs
Covered lines:65
Uncovered lines:15
Coverable lines:80
Total lines:232
Line coverage:81.2% (65 of 80)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor()-100%100%
.ctor(...)-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
get_StoreLocation()-100%100%
set_StoreLocation(...)-100%100%
get_StoreName()-100%100%
set_StoreName(...)-100%100%
get_Thumbprint()-100%100%
set_Thumbprint(...)-100%100%
get_ThumbprintAlgorithm()-100%100%
set_ThumbprintAlgorithm(...)-100%100%
get_Visibility()-100%100%
set_Visibility(...)-100%100%
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()-0%100%
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()-0%100%
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)-100%100%
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.CertificateReference>.GetTransportObject()-100%100%
ConvertFromProtocolCollection(...)-100%100%
ConvertFromProtocolCollectionAndFreeze(...)-0%100%
ConvertFromProtocolCollectionReadOnly(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\CertificateReference.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for license information.
 3
 4namespace Microsoft.Azure.Batch
 5{
 6    public partial class CertificateReference
 7    {
 8        /// <summary>
 9        /// Instantiates an instance of CertificateReference with default property values.
 10        /// Values for the Thumbprint and ThumbprintAlgorithm properties are taken from the provided base certificate.
 11        /// </summary>
 12        /// <param name="baseCertificate">Provides initial values for the CertificateReference properties Thumbprint and
 013        public CertificateReference(Certificate baseCertificate) : this()
 14        {
 015            this.Thumbprint = baseCertificate.Thumbprint;
 016            this.ThumbprintAlgorithm = baseCertificate.ThumbprintAlgorithm;
 017        }
 18    }
 19}

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\CertificateReference.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for license information.
 3//
 4// Code generated by Microsoft (R) AutoRest Code Generator.
 5// Changes may cause incorrect behavior and will be lost if the code is
 6// regenerated.
 7
 8//
 9// This file was autogenerated by a tool.
 10// Do not modify it.
 11//
 12
 013namespace Microsoft.Azure.Batch
 14{
 015    using Models = Microsoft.Azure.Batch.Protocol.Models;
 016    using System;
 017    using System.Collections.Generic;
 18    using System.Linq;
 19
 20    /// <summary>
 21    /// Represents a certificate object of the Azure Batch service.
 22    /// </summary>
 23    public partial class CertificateReference : ITransportObjectProvider<Models.CertificateReference>, IPropertyMetadata
 24    {
 25        private class PropertyContainer : PropertyCollection
 26        {
 27            public readonly PropertyAccessor<Common.CertStoreLocation?> StoreLocationProperty;
 28            public readonly PropertyAccessor<string> StoreNameProperty;
 29            public readonly PropertyAccessor<string> ThumbprintProperty;
 30            public readonly PropertyAccessor<string> ThumbprintAlgorithmProperty;
 31            public readonly PropertyAccessor<Common.CertificateVisibility?> VisibilityProperty;
 32
 81633            public PropertyContainer() : base(BindingState.Unbound)
 34            {
 81635                this.StoreLocationProperty = this.CreatePropertyAccessor<Common.CertStoreLocation?>(nameof(StoreLocation
 81636                this.StoreNameProperty = this.CreatePropertyAccessor<string>(nameof(StoreName), BindingAccess.Read | Bin
 81637                this.ThumbprintProperty = this.CreatePropertyAccessor<string>(nameof(Thumbprint), BindingAccess.Read | B
 81638                this.ThumbprintAlgorithmProperty = this.CreatePropertyAccessor<string>(nameof(ThumbprintAlgorithm), Bind
 81639                this.VisibilityProperty = this.CreatePropertyAccessor<Common.CertificateVisibility?>(nameof(Visibility),
 81640            }
 41
 479642            public PropertyContainer(Models.CertificateReference protocolObject) : base(BindingState.Bound)
 43            {
 479644                this.StoreLocationProperty = this.CreatePropertyAccessor(
 479645                    UtilitiesInternal.MapNullableEnum<Models.CertificateStoreLocation, Common.CertStoreLocation>(protoco
 479646                    nameof(StoreLocation),
 479647                    BindingAccess.Read | BindingAccess.Write);
 479648                this.StoreNameProperty = this.CreatePropertyAccessor(
 479649                    protocolObject.StoreName,
 479650                    nameof(StoreName),
 479651                    BindingAccess.Read | BindingAccess.Write);
 479652                this.ThumbprintProperty = this.CreatePropertyAccessor(
 479653                    protocolObject.Thumbprint,
 479654                    nameof(Thumbprint),
 479655                    BindingAccess.Read | BindingAccess.Write);
 479656                this.ThumbprintAlgorithmProperty = this.CreatePropertyAccessor(
 479657                    protocolObject.ThumbprintAlgorithm,
 479658                    nameof(ThumbprintAlgorithm),
 479659                    BindingAccess.Read | BindingAccess.Write);
 479660                this.VisibilityProperty = this.CreatePropertyAccessor(
 479661                    UtilitiesInternal.ParseCertificateVisibility(protocolObject.Visibility),
 479662                    nameof(Visibility),
 479663                    BindingAccess.Read | BindingAccess.Write);
 479664            }
 65        }
 66
 67        private readonly PropertyContainer propertyContainer;
 68
 69        #region Constructors
 70
 71        /// <summary>
 72        /// Initializes a new instance of the <see cref="CertificateReference"/> class.
 73        /// </summary>
 81674        public CertificateReference()
 75        {
 81676            this.propertyContainer = new PropertyContainer();
 81677        }
 78
 479679        internal CertificateReference(Models.CertificateReference protocolObject)
 80        {
 479681            this.propertyContainer = new PropertyContainer(protocolObject);
 479682        }
 83
 84        #endregion Constructors
 85
 86        #region CertificateReference
 87
 88        /// <summary>
 89        /// Gets or sets the <see cref="Common.CertStoreLocation"/> for the certificate.
 90        /// </summary>
 91        public Common.CertStoreLocation? StoreLocation
 92        {
 642593            get { return this.propertyContainer.StoreLocationProperty.Value; }
 77494            set { this.propertyContainer.StoreLocationProperty.Value = value; }
 95        }
 96
 97        /// <summary>
 98        /// Gets or sets the name of the name of the certificate store. Besides <see cref="System.Security.Cryptography.
 99        /// the value can have a custom store name.
 100        /// </summary>
 101        public string StoreName
 102        {
 6425103            get { return this.propertyContainer.StoreNameProperty.Value; }
 772104            set { this.propertyContainer.StoreNameProperty.Value = value; }
 105        }
 106
 107        /// <summary>
 108        /// Gets or sets the certificate thumbprint property of the certificate.
 109        /// </summary>
 110        public string Thumbprint
 111        {
 6425112            get { return this.propertyContainer.ThumbprintProperty.Value; }
 806113            set { this.propertyContainer.ThumbprintProperty.Value = value; }
 114        }
 115
 116        /// <summary>
 117        /// Gets or sets the certificate thumbprint algorithm. Currently sha1 is the only supported algorithm.
 118        /// </summary>
 119        public string ThumbprintAlgorithm
 120        {
 6425121            get { return this.propertyContainer.ThumbprintAlgorithmProperty.Value; }
 790122            set { this.propertyContainer.ThumbprintAlgorithmProperty.Value = value; }
 123        }
 124
 125        /// <summary>
 126        /// Gets or sets the set of users that can get to the private data of the installed certificate.
 127        /// </summary>
 128        public Common.CertificateVisibility? Visibility
 129        {
 6425130            get { return this.propertyContainer.VisibilityProperty.Value; }
 770131            set { this.propertyContainer.VisibilityProperty.Value = value; }
 132        }
 133
 134        #endregion // CertificateReference
 135
 136        #region IPropertyMetadata
 137
 138        bool IModifiable.HasBeenModified
 139        {
 0140            get { return this.propertyContainer.HasBeenModified; }
 141        }
 142
 143        bool IReadOnly.IsReadOnly
 144        {
 0145            get { return this.propertyContainer.IsReadOnly; }
 11022146            set { this.propertyContainer.IsReadOnly = value; }
 147        }
 148
 149        #endregion //IPropertyMetadata
 150
 151        #region Internal/private methods
 152        /// <summary>
 153        /// Return a protocol object of the requested type.
 154        /// </summary>
 155        /// <returns>The protocol object of the requested type.</returns>
 156        Models.CertificateReference ITransportObjectProvider<Models.CertificateReference>.GetTransportObject()
 157        {
 814158            Models.CertificateReference result = new Models.CertificateReference()
 814159            {
 814160                StoreLocation = UtilitiesInternal.MapNullableEnum<Common.CertStoreLocation, Models.CertificateStoreLocat
 814161                StoreName = this.StoreName,
 814162                Thumbprint = this.Thumbprint,
 814163                ThumbprintAlgorithm = this.ThumbprintAlgorithm,
 814164                Visibility = UtilitiesInternal.CertificateVisibilityToList(this.Visibility),
 814165            };
 166
 814167            return result;
 168        }
 169
 170        /// <summary>
 171        /// Converts a collection of protocol layer objects to object layer collection objects.
 172        /// </summary>
 173        internal static IList<CertificateReference> ConvertFromProtocolCollection(IEnumerable<Models.CertificateReferenc
 174        {
 1224175            ConcurrentChangeTrackedModifiableList<CertificateReference> converted = UtilitiesInternal.CollectionToThread
 1224176                items: protoCollection,
 3889177                objectCreationFunc: o => new CertificateReference(o));
 178
 1224179            return converted;
 180        }
 181
 182        /// <summary>
 183        /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state.
 184        /// </summary>
 185        internal static IList<CertificateReference> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.Certificat
 186        {
 0187            ConcurrentChangeTrackedModifiableList<CertificateReference> converted = UtilitiesInternal.CollectionToThread
 0188                items: protoCollection,
 0189                objectCreationFunc: o => new CertificateReference(o).Freeze());
 190
 0191            converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze());
 192
 0193            return converted;
 194        }
 195
 196        /// <summary>
 197        /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked 
 198        /// and returned as a readonly collection.
 199        /// </summary>
 200        internal static IReadOnlyList<CertificateReference> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.Cer
 201        {
 1003202            IReadOnlyList<CertificateReference> converted =
 1003203                UtilitiesInternal.CreateObjectWithNullCheck(
 1003204                    UtilitiesInternal.CollectionToNonThreadSafeCollection(
 1003205                        items: protoCollection,
 3627206                        objectCreationFunc: o => new CertificateReference(o).Freeze()), o => o.AsReadOnly());
 207
 1003208            return converted;
 209        }
 210
 211        #endregion // Internal/private methods
 212    }
 213}