< Summary

Class:Microsoft.Azure.Batch.UserAccount
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\UserAccount.cs
Covered lines:74
Uncovered lines:8
Coverable lines:82
Total lines:239
Line coverage:90.2% (74 of 82)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
.ctor(...)-100%100%
.ctor(...)-100%100%
get_ElevationLevel()-100%100%
set_ElevationLevel(...)-100%100%
get_LinuxUserConfiguration()-100%100%
set_LinuxUserConfiguration(...)-100%100%
get_Name()-100%100%
set_Name(...)-100%100%
get_Password()-100%100%
set_Password(...)-100%100%
get_WindowsUserConfiguration()-100%100%
set_WindowsUserConfiguration(...)-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.UserAccount>.GetTransportObject()-100%100%
ConvertFromProtocolCollection(...)-100%100%
ConvertFromProtocolCollectionAndFreeze(...)-100%100%
ConvertFromProtocolCollectionReadOnly(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\UserAccount.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
 13namespace Microsoft.Azure.Batch
 14{
 15    using Models = Microsoft.Azure.Batch.Protocol.Models;
 16    using System;
 17    using System.Collections.Generic;
 18    using System.Linq;
 19
 20    /// <summary>
 21    /// A user account to create on an Azure Batch node. Tasks may be configured to execute in the security context of t
 22    /// user account.
 23    /// </summary>
 24    public partial class UserAccount : ITransportObjectProvider<Models.UserAccount>, IPropertyMetadata
 25    {
 26        private class PropertyContainer : PropertyCollection
 27        {
 28            public readonly PropertyAccessor<Common.ElevationLevel?> ElevationLevelProperty;
 29            public readonly PropertyAccessor<LinuxUserConfiguration> LinuxUserConfigurationProperty;
 30            public readonly PropertyAccessor<string> NameProperty;
 31            public readonly PropertyAccessor<string> PasswordProperty;
 32            public readonly PropertyAccessor<WindowsUserConfiguration> WindowsUserConfigurationProperty;
 33
 82634            public PropertyContainer() : base(BindingState.Unbound)
 35            {
 82636                this.ElevationLevelProperty = this.CreatePropertyAccessor<Common.ElevationLevel?>(nameof(ElevationLevel)
 82637                this.LinuxUserConfigurationProperty = this.CreatePropertyAccessor<LinuxUserConfiguration>(nameof(LinuxUs
 82638                this.NameProperty = this.CreatePropertyAccessor<string>(nameof(Name), BindingAccess.Read | BindingAccess
 82639                this.PasswordProperty = this.CreatePropertyAccessor<string>(nameof(Password), BindingAccess.Read | Bindi
 82640                this.WindowsUserConfigurationProperty = this.CreatePropertyAccessor<WindowsUserConfiguration>(nameof(Win
 82641            }
 42
 276043            public PropertyContainer(Models.UserAccount protocolObject) : base(BindingState.Bound)
 44            {
 276045                this.ElevationLevelProperty = this.CreatePropertyAccessor(
 276046                    UtilitiesInternal.MapNullableEnum<Models.ElevationLevel, Common.ElevationLevel>(protocolObject.Eleva
 276047                    nameof(ElevationLevel),
 276048                    BindingAccess.Read);
 276049                this.LinuxUserConfigurationProperty = this.CreatePropertyAccessor(
 417350                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.LinuxUserConfiguration, o => new LinuxUse
 276051                    nameof(LinuxUserConfiguration),
 276052                    BindingAccess.Read);
 276053                this.NameProperty = this.CreatePropertyAccessor(
 276054                    protocolObject.Name,
 276055                    nameof(Name),
 276056                    BindingAccess.Read);
 276057                this.PasswordProperty = this.CreatePropertyAccessor(
 276058                    protocolObject.Password,
 276059                    nameof(Password),
 276060                    BindingAccess.Read);
 276061                this.WindowsUserConfigurationProperty = this.CreatePropertyAccessor(
 417062                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.WindowsUserConfiguration, o => new Window
 276063                    nameof(WindowsUserConfiguration),
 276064                    BindingAccess.Read);
 276065            }
 66        }
 67
 68        private readonly PropertyContainer propertyContainer;
 69
 70        #region Constructors
 71
 72        /// <summary>
 73        /// Initializes a new instance of the <see cref="UserAccount"/> class.
 74        /// </summary>
 75        /// <param name='name'>The name of the user account.</param>
 76        /// <param name='password'>The password for the user account.</param>
 77        /// <param name='elevationLevel'>The elevation level of the user account.</param>
 78        /// <param name='linuxUserConfiguration'>Additional properties used to create a user account on a Linux node.</p
 79        /// <param name='windowsUserConfiguration'>The Windows-specific user configuration for the user account.</param>
 82680        public UserAccount(
 82681            string name,
 82682            string password,
 82683            Common.ElevationLevel? elevationLevel = default(Common.ElevationLevel?),
 82684            LinuxUserConfiguration linuxUserConfiguration = default(LinuxUserConfiguration),
 82685            WindowsUserConfiguration windowsUserConfiguration = default(WindowsUserConfiguration))
 86        {
 82687            this.propertyContainer = new PropertyContainer();
 82688            this.Name = name;
 82689            this.Password = password;
 82690            this.ElevationLevel = elevationLevel;
 82691            this.LinuxUserConfiguration = linuxUserConfiguration;
 82692            this.WindowsUserConfiguration = windowsUserConfiguration;
 82693        }
 94
 276095        internal UserAccount(Models.UserAccount protocolObject)
 96        {
 276097            this.propertyContainer = new PropertyContainer(protocolObject);
 276098        }
 99
 100        #endregion Constructors
 101
 102        #region UserAccount
 103
 104        /// <summary>
 105        /// Gets or sets the elevation level of the user account.
 106        /// </summary>
 107        /// <remarks>
 108        /// If omitted, the default is <see cref="Common.ElevationLevel.NonAdmin"/>
 109        /// </remarks>
 110        public Common.ElevationLevel? ElevationLevel
 111        {
 4411112            get { return this.propertyContainer.ElevationLevelProperty.Value; }
 2455113            set { this.propertyContainer.ElevationLevelProperty.Value = value; }
 114        }
 115
 116        /// <summary>
 117        /// Gets or sets additional properties used to create a user account on a Linux node.
 118        /// </summary>
 119        /// <remarks>
 120        /// This property is ignored if specified on a Windows pool. If not specified, the user is created with the defa
 121        /// options.
 122        /// </remarks>
 123        public LinuxUserConfiguration LinuxUserConfiguration
 124        {
 4411125            get { return this.propertyContainer.LinuxUserConfigurationProperty.Value; }
 2491126            set { this.propertyContainer.LinuxUserConfigurationProperty.Value = value; }
 127        }
 128
 129        /// <summary>
 130        /// Gets or sets the name of the user account.
 131        /// </summary>
 132        public string Name
 133        {
 4411134            get { return this.propertyContainer.NameProperty.Value; }
 2517135            set { this.propertyContainer.NameProperty.Value = value; }
 136        }
 137
 138        /// <summary>
 139        /// Gets or sets the password for the user account.
 140        /// </summary>
 141        public string Password
 142        {
 4411143            get { return this.propertyContainer.PasswordProperty.Value; }
 2457144            set { this.propertyContainer.PasswordProperty.Value = value; }
 145        }
 146
 147        /// <summary>
 148        /// Gets or sets the Windows-specific user configuration for the user account.
 149        /// </summary>
 150        /// <remarks>
 151        /// This property can only be specified if the user is on a Windows pool. If not specified and on a Windows pool
 152        /// the user is created with the default options.
 153        /// </remarks>
 154        public WindowsUserConfiguration WindowsUserConfiguration
 155        {
 4411156            get { return this.propertyContainer.WindowsUserConfigurationProperty.Value; }
 2465157            set { this.propertyContainer.WindowsUserConfigurationProperty.Value = value; }
 158        }
 159
 160        #endregion // UserAccount
 161
 162        #region IPropertyMetadata
 163
 164        bool IModifiable.HasBeenModified
 165        {
 0166            get { return this.propertyContainer.HasBeenModified; }
 167        }
 168
 169        bool IReadOnly.IsReadOnly
 170        {
 0171            get { return this.propertyContainer.IsReadOnly; }
 16248172            set { this.propertyContainer.IsReadOnly = value; }
 173        }
 174
 175        #endregion //IPropertyMetadata
 176
 177        #region Internal/private methods
 178        /// <summary>
 179        /// Return a protocol object of the requested type.
 180        /// </summary>
 181        /// <returns>The protocol object of the requested type.</returns>
 182        Models.UserAccount ITransportObjectProvider<Models.UserAccount>.GetTransportObject()
 183        {
 825184            Models.UserAccount result = new Models.UserAccount()
 825185            {
 825186                ElevationLevel = UtilitiesInternal.MapNullableEnum<Common.ElevationLevel, Models.ElevationLevel>(this.El
 1650187                LinuxUserConfiguration = UtilitiesInternal.CreateObjectWithNullCheck(this.LinuxUserConfiguration, (o) =>
 825188                Name = this.Name,
 825189                Password = this.Password,
 1650190                WindowsUserConfiguration = UtilitiesInternal.CreateObjectWithNullCheck(this.WindowsUserConfiguration, (o
 825191            };
 192
 825193            return result;
 194        }
 195
 196        /// <summary>
 197        /// Converts a collection of protocol layer objects to object layer collection objects.
 198        /// </summary>
 199        internal static IList<UserAccount> ConvertFromProtocolCollection(IEnumerable<Models.UserAccount> protoCollection
 200        {
 198201            ConcurrentChangeTrackedModifiableList<UserAccount> converted = UtilitiesInternal.CollectionToThreadSafeColle
 198202                items: protoCollection,
 639203                objectCreationFunc: o => new UserAccount(o));
 204
 198205            return converted;
 206        }
 207
 208        /// <summary>
 209        /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state.
 210        /// </summary>
 211        internal static IList<UserAccount> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.UserAccount> protoC
 212        {
 1026213            ConcurrentChangeTrackedModifiableList<UserAccount> converted = UtilitiesInternal.CollectionToThreadSafeColle
 1026214                items: protoCollection,
 3345215                objectCreationFunc: o => new UserAccount(o).Freeze());
 216
 1535217            converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze());
 218
 1026219            return converted;
 220        }
 221
 222        /// <summary>
 223        /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked 
 224        /// and returned as a readonly collection.
 225        /// </summary>
 226        internal static IReadOnlyList<UserAccount> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.UserAccount>
 227        {
 0228            IReadOnlyList<UserAccount> converted =
 0229                UtilitiesInternal.CreateObjectWithNullCheck(
 0230                    UtilitiesInternal.CollectionToNonThreadSafeCollection(
 0231                        items: protoCollection,
 0232                        objectCreationFunc: o => new UserAccount(o).Freeze()), o => o.AsReadOnly());
 233
 0234            return converted;
 235        }
 236
 237        #endregion // Internal/private methods
 238    }
 239}