< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Description.OperationDescriptionCollection
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Description/OperationDescriptionCollection.cs
Line coverage
63%
Covered lines: 12
Uncovered lines: 7
Coverable lines: 19
Total lines: 57
Line coverage: 63.1%
Branch coverage
50%
Covered branches: 6
Total branches: 12
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
Find(...)50%4475%
FindAll(...)75%4480%
InsertItem(...)50%2275%
SetItem(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Description/OperationDescriptionCollection.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Collections.ObjectModel;
 5
 6namespace CoreWCF.Description
 7{
 8    public class OperationDescriptionCollection : Collection<OperationDescription>
 9    {
 68510        internal OperationDescriptionCollection()
 11        {
 68512        }
 13
 14        public OperationDescription Find(string name)
 15        {
 3216            for (int i = 0; i < Count; i++)
 17            {
 1618                if (this[i].Name == name)
 19                {
 1620                    return this[i];
 21                }
 22            }
 023            return null;
 24        }
 25
 26        public Collection<OperationDescription> FindAll(string name)
 27        {
 283728            Collection<OperationDescription> results = new Collection<OperationDescription>();
 2527829            for (int i = 0; i < Count; i++)
 30            {
 980231                if (this[i].Name == name)
 32                {
 033                    results.Add(this[i]);
 34                }
 35            }
 283736            return results;
 37        }
 38
 39        protected override void InsertItem(int index, OperationDescription item)
 40        {
 283741            if (item == null)
 42            {
 043                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(item));
 44            }
 283745            base.InsertItem(index, item);
 283746        }
 47
 48        protected override void SetItem(int index, OperationDescription item)
 49        {
 050            if (item == null)
 51            {
 052                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(item));
 53            }
 054            base.SetItem(index, item);
 055        }
 56    }
 57}