< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Description.PolicyConversionContext
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Description/PolicyConversionContext.cs
Line coverage
31%
Covered lines: 5
Uncovered lines: 11
Coverable lines: 16
Total lines: 52
Line coverage: 31.2%
Branch coverage
8%
Covered branches: 1
Total branches: 12
Branch coverage: 8.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)50%2280%
FindAssertion(...)0%10100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Description/PolicyConversionContext.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.Generic;
 5using System.Xml;
 6using CoreWCF.Channels;
 7
 8namespace CoreWCF.Description
 9{
 10    public abstract class PolicyConversionContext
 11    {
 4112        protected PolicyConversionContext(ServiceEndpoint endpoint)
 13        {
 4114            if (endpoint == null)
 15            {
 016                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpoint));
 17            }
 18
 4119            Contract = endpoint.Contract;
 4120        }
 21
 22        public abstract BindingElementCollection BindingElements { get; }
 023        public virtual BindingParameterCollection BindingParameters => null;
 4024        public ContractDescription Contract { get; }
 25        public abstract PolicyAssertionCollection GetBindingAssertions();
 26        public abstract PolicyAssertionCollection GetOperationBindingAssertions(OperationDescription operation);
 27        public abstract PolicyAssertionCollection GetMessageBindingAssertions(MessageDescription message);
 28        public abstract PolicyAssertionCollection GetFaultBindingAssertions(FaultDescription fault);
 29
 30        internal static XmlElement FindAssertion(ICollection<XmlElement> assertions, string localName, string namespaceU
 31        {
 032            XmlElement result = null;
 033            foreach (XmlElement assertion in assertions)
 34            {
 035                if ((assertion.LocalName == localName) &&
 036                    ((namespaceUri == null) || (assertion.NamespaceURI == namespaceUri)))
 37                {
 038                    result = assertion;
 039                    if (remove)
 40                    {
 041                        assertions.Remove(result);
 42                    }
 43
 044                    break;
 45                }
 46            }
 47
 048            return result;
 49        }
 50
 51    }
 52}