< Summary

Class:Microsoft.Azure.Batch.ExitConditions
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\ExitConditions.cs
Covered lines:57
Uncovered lines:17
Coverable lines:74
Total lines:228
Line coverage:77% (57 of 74)
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_Default()-100%100%
set_Default(...)-100%100%
get_ExitCodeRanges()-100%100%
set_ExitCodeRanges(...)-100%100%
get_ExitCodes()-100%100%
set_ExitCodes(...)-100%100%
get_FileUploadError()-100%100%
set_FileUploadError(...)-100%100%
get_PreProcessingError()-100%100%
set_PreProcessingError(...)-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.ExitConditions>.GetTransportObject()-100%100%
ConvertFromProtocolCollection(...)-0%100%
ConvertFromProtocolCollectionAndFreeze(...)-0%100%
ConvertFromProtocolCollectionReadOnly(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\ExitConditions.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    /// How the Batch service should respond when a task completes.
 22    /// </summary>
 23    public partial class ExitConditions : ITransportObjectProvider<Models.ExitConditions>, IPropertyMetadata
 24    {
 25        private class PropertyContainer : PropertyCollection
 26        {
 27            public readonly PropertyAccessor<ExitOptions> DefaultProperty;
 28            public readonly PropertyAccessor<IList<ExitCodeRangeMapping>> ExitCodeRangesProperty;
 29            public readonly PropertyAccessor<IList<ExitCodeMapping>> ExitCodesProperty;
 30            public readonly PropertyAccessor<ExitOptions> FileUploadErrorProperty;
 31            public readonly PropertyAccessor<ExitOptions> PreProcessingErrorProperty;
 32
 15233            public PropertyContainer() : base(BindingState.Unbound)
 34            {
 15235                this.DefaultProperty = this.CreatePropertyAccessor<ExitOptions>(nameof(Default), BindingAccess.Read | Bi
 15236                this.ExitCodeRangesProperty = this.CreatePropertyAccessor<IList<ExitCodeRangeMapping>>(nameof(ExitCodeRa
 15237                this.ExitCodesProperty = this.CreatePropertyAccessor<IList<ExitCodeMapping>>(nameof(ExitCodes), BindingA
 15238                this.FileUploadErrorProperty = this.CreatePropertyAccessor<ExitOptions>(nameof(FileUploadError), Binding
 15239                this.PreProcessingErrorProperty = this.CreatePropertyAccessor<ExitOptions>(nameof(PreProcessingError), B
 15240            }
 41
 50442            public PropertyContainer(Models.ExitConditions protocolObject) : base(BindingState.Bound)
 43            {
 50444                this.DefaultProperty = this.CreatePropertyAccessor(
 75945                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.DefaultProperty, o => new ExitOptions(o).
 50446                    nameof(Default),
 50447                    BindingAccess.Read);
 50448                this.ExitCodeRangesProperty = this.CreatePropertyAccessor(
 50449                    ExitCodeRangeMapping.ConvertFromProtocolCollectionAndFreeze(protocolObject.ExitCodeRanges),
 50450                    nameof(ExitCodeRanges),
 50451                    BindingAccess.Read);
 50452                this.ExitCodesProperty = this.CreatePropertyAccessor(
 50453                    ExitCodeMapping.ConvertFromProtocolCollectionAndFreeze(protocolObject.ExitCodes),
 50454                    nameof(ExitCodes),
 50455                    BindingAccess.Read);
 50456                this.FileUploadErrorProperty = this.CreatePropertyAccessor(
 76357                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.FileUploadError, o => new ExitOptions(o).
 50458                    nameof(FileUploadError),
 50459                    BindingAccess.Read);
 50460                this.PreProcessingErrorProperty = this.CreatePropertyAccessor(
 76861                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.PreProcessingError, o => new ExitOptions(
 50462                    nameof(PreProcessingError),
 50463                    BindingAccess.Read);
 50464            }
 65        }
 66
 67        private readonly PropertyContainer propertyContainer;
 68
 69        #region Constructors
 70
 71        /// <summary>
 72        /// Initializes a new instance of the <see cref="ExitConditions"/> class.
 73        /// </summary>
 15274        public ExitConditions()
 75        {
 15276            this.propertyContainer = new PropertyContainer();
 15277        }
 78
 50479        internal ExitConditions(Models.ExitConditions protocolObject)
 80        {
 50481            this.propertyContainer = new PropertyContainer(protocolObject);
 50482        }
 83
 84        #endregion Constructors
 85
 86        #region ExitConditions
 87
 88        /// <summary>
 89        /// Gets or sets how the Batch service should respond if the task fails with an exit condition not covered by an
 90        /// of the other properties.
 91        /// </summary>
 92        /// <remarks>
 93        /// This value is used if the task exits with any nonzero exit code not listed in the <see cref="ExitCodes"/> or
 94        /// <see cref="ExitCodeRanges"/> collection, with a preprocessing error if the <see cref="PreProcessingError"/> 
 95        /// is not present, or with a file upload failure if the <see cref="FileUploadError"/> property is not present.
 96        /// </remarks>
 97        public ExitOptions Default
 98        {
 80599            get { return this.propertyContainer.DefaultProperty.Value; }
 148100            set { this.propertyContainer.DefaultProperty.Value = value; }
 101        }
 102
 103        /// <summary>
 104        /// Gets or sets a list of task exit code ranges and how the Batch service should respond to them.
 105        /// </summary>
 106        public IList<ExitCodeRangeMapping> ExitCodeRanges
 107        {
 803108            get { return this.propertyContainer.ExitCodeRangesProperty.Value; }
 109            set
 110            {
 83111                this.propertyContainer.ExitCodeRangesProperty.Value = ConcurrentChangeTrackedModifiableList<ExitCodeRang
 82112            }
 113        }
 114
 115        /// <summary>
 116        /// Gets or sets a list of task exit codes and how the Batch service should respond to them.
 117        /// </summary>
 118        public IList<ExitCodeMapping> ExitCodes
 119        {
 803120            get { return this.propertyContainer.ExitCodesProperty.Value; }
 121            set
 122            {
 83123                this.propertyContainer.ExitCodesProperty.Value = ConcurrentChangeTrackedModifiableList<ExitCodeMapping>.
 82124            }
 125        }
 126
 127        /// <summary>
 128        /// Gets or sets how the Batch service should respond if a file upload error occurs.
 129        /// </summary>
 130        /// <remarks>
 131        /// If the task exited with an exit code that was specified via <see cref="ExitCodes" /> or <see cref="ExitCodeR
 132        /// />, and then encountered a file upload error, then the action specified by the exit code takes precedence.
 133        /// </remarks>
 134        public ExitOptions FileUploadError
 135        {
 804136            get { return this.propertyContainer.FileUploadErrorProperty.Value; }
 155137            set { this.propertyContainer.FileUploadErrorProperty.Value = value; }
 138        }
 139
 140        /// <summary>
 141        /// Gets or sets how the Batch service should respond if the task fails to start due to an error.
 142        /// </summary>
 143        public ExitOptions PreProcessingError
 144        {
 803145            get { return this.propertyContainer.PreProcessingErrorProperty.Value; }
 155146            set { this.propertyContainer.PreProcessingErrorProperty.Value = value; }
 147        }
 148
 149        #endregion // ExitConditions
 150
 151        #region IPropertyMetadata
 152
 153        bool IModifiable.HasBeenModified
 154        {
 0155            get { return this.propertyContainer.HasBeenModified; }
 156        }
 157
 158        bool IReadOnly.IsReadOnly
 159        {
 0160            get { return this.propertyContainer.IsReadOnly; }
 1012161            set { this.propertyContainer.IsReadOnly = value; }
 162        }
 163
 164        #endregion //IPropertyMetadata
 165
 166        #region Internal/private methods
 167        /// <summary>
 168        /// Return a protocol object of the requested type.
 169        /// </summary>
 170        /// <returns>The protocol object of the requested type.</returns>
 171        Models.ExitConditions ITransportObjectProvider<Models.ExitConditions>.GetTransportObject()
 172        {
 150173            Models.ExitConditions result = new Models.ExitConditions()
 150174            {
 223175                DefaultProperty = UtilitiesInternal.CreateObjectWithNullCheck(this.Default, (o) => o.GetTransportObject(
 150176                ExitCodeRanges = UtilitiesInternal.ConvertToProtocolCollection(this.ExitCodeRanges),
 150177                ExitCodes = UtilitiesInternal.ConvertToProtocolCollection(this.ExitCodes),
 227178                FileUploadError = UtilitiesInternal.CreateObjectWithNullCheck(this.FileUploadError, (o) => o.GetTranspor
 227179                PreProcessingError = UtilitiesInternal.CreateObjectWithNullCheck(this.PreProcessingError, (o) => o.GetTr
 150180            };
 181
 150182            return result;
 183        }
 184
 185        /// <summary>
 186        /// Converts a collection of protocol layer objects to object layer collection objects.
 187        /// </summary>
 188        internal static IList<ExitConditions> ConvertFromProtocolCollection(IEnumerable<Models.ExitConditions> protoColl
 189        {
 0190            ConcurrentChangeTrackedModifiableList<ExitConditions> converted = UtilitiesInternal.CollectionToThreadSafeCo
 0191                items: protoCollection,
 0192                objectCreationFunc: o => new ExitConditions(o));
 193
 0194            return converted;
 195        }
 196
 197        /// <summary>
 198        /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state.
 199        /// </summary>
 200        internal static IList<ExitConditions> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.ExitConditions> 
 201        {
 0202            ConcurrentChangeTrackedModifiableList<ExitConditions> converted = UtilitiesInternal.CollectionToThreadSafeCo
 0203                items: protoCollection,
 0204                objectCreationFunc: o => new ExitConditions(o).Freeze());
 205
 0206            converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze());
 207
 0208            return converted;
 209        }
 210
 211        /// <summary>
 212        /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked 
 213        /// and returned as a readonly collection.
 214        /// </summary>
 215        internal static IReadOnlyList<ExitConditions> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.ExitCondi
 216        {
 0217            IReadOnlyList<ExitConditions> converted =
 0218                UtilitiesInternal.CreateObjectWithNullCheck(
 0219                    UtilitiesInternal.CollectionToNonThreadSafeCollection(
 0220                        items: protoCollection,
 0221                        objectCreationFunc: o => new ExitConditions(o).Freeze()), o => o.AsReadOnly());
 222
 0223            return converted;
 224        }
 225
 226        #endregion // Internal/private methods
 227    }
 228}