< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.DnsEndpointIdentity
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/DnsEndpointIdentity.cs
Line coverage
31%
Covered lines: 5
Uncovered lines: 11
Coverable lines: 16
Total lines: 46
Line coverage: 31.2%
Branch coverage
25%
Covered branches: 2
Total branches: 8
Branch coverage: 25%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)0%220%
.ctor(...)50%4471.42%
WriteContentsTo(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/DnsEndpointIdentity.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.Xml;
 5using CoreWCF.IdentityModel.Claims;
 6
 7namespace CoreWCF
 8{
 9    internal class DnsEndpointIdentity : EndpointIdentity
 10    {
 011        public DnsEndpointIdentity(string dnsName)
 12        {
 013            if (dnsName == null)
 14            {
 015                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(dnsName));
 16            }
 17
 018            Initialize(Claim.CreateDnsClaim(dnsName));
 019        }
 20
 521        public DnsEndpointIdentity(Claim identity)
 22        {
 523            if (identity == null)
 24            {
 025                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(identity));
 26            }
 27
 528            if (!identity.ClaimType.Equals(ClaimTypes.Dns))
 29            {
 030                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.Format(SR.UnrecognizedClaimTypeForIdenti
 31            }
 32
 533            Initialize(identity);
 534        }
 35
 36        internal override void WriteContentsTo(XmlDictionaryWriter writer)
 37        {
 038            if (writer == null)
 39            {
 040                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(writer));
 41            }
 42
 043            writer.WriteElementString(XD.AddressingDictionary.Dns, XD.AddressingDictionary.IdentityExtensionNamespace, (
 044        }
 45    }
 46}