< Summary

Class:Microsoft.Azure.Batch.InheritUtil
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\IInheritedBehaviors.cs
Covered lines:5
Uncovered lines:0
Coverable lines:5
Total lines:45
Line coverage:100% (5 of 5)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
InheritClientBehaviorsAndSetPublicProperty(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\IInheritedBehaviors.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
 4using System;
 5using System.Collections.Generic;
 6using System.Linq;
 7using System.Text;
 8using System.Threading.Tasks;
 9
 10namespace Microsoft.Azure.Batch
 11{
 12    /// <summary>
 13    /// Methods and properties that are inherited from the instantiating parent object.
 14    /// </summary>
 15    public interface IInheritedBehaviors
 16    {
 17        /// <summary>
 18        /// This collection is initially populated by instantiation or by copying from the instantiating parent object (
 19        /// In this model, the collections are independent but the members are shared references.
 20        /// Members of this collection alter or customize various behaviors of Azure Batch Service client objects.
 21        /// These behaviors are generally inherited by any child class instances.
 22        /// Modifications are applied in the order of the collection.
 23        /// The last write wins.
 24        /// </summary>
 25        IList<BatchClientBehavior> CustomBehaviors { get; set; }
 26    }
 27
 28    internal class InheritUtil
 29    {
 30        internal static void InheritClientBehaviorsAndSetPublicProperty(IInheritedBehaviors inheritingObject, IEnumerabl
 31        {
 32            // implement inheritance of behaviors
 778733            List<BatchClientBehavior> customBehaviors = new List<BatchClientBehavior>();
 34
 35            // if there were any behaviors, pre-populate the collection (ie: inherit)
 778736            if (null != baseBehaviors)
 37            {
 675938                customBehaviors.AddRange(baseBehaviors);
 39            }
 40
 41            // set the public property
 778742            inheritingObject.CustomBehaviors = customBehaviors;
 778743        }
 44    }
 45}