< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.UriUtil
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/UriUtil.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 39
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
CanCreateValidUri(...)100%110%
TryCreateValidUri(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/UriUtil.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;
 5
 6namespace CoreWCF.IdentityModel
 7{
 8    internal static class UriUtil
 9    {
 10        /// <summary>
 11        /// Determines whether a URI is valid and can be created using the specified UriKind.
 12        /// Uri.TryCreate is used here, which is more lax than Uri.IsWellFormedUriString.
 13        /// The reason we use this function is because IsWellFormedUriString will reject valid URIs if they are IPv6 or 
 14        /// </summary>
 15        /// <param name="uriString">The string to check.</param>
 16        /// <param name="uriKind">The type of URI (usually UriKind.Absolute)</param>
 17        /// <returns>True if the URI is valid, false otherwise.</returns>
 18        public static bool CanCreateValidUri(string uriString, UriKind uriKind)
 19        {
 20            Uri tempUri;
 21
 022            return TryCreateValidUri(uriString, uriKind, out tempUri);
 23        }
 24
 25        /// <summary>
 26        /// Determines whether a URI is valid and can be created using the specified UriKind.
 27        /// Uri.TryCreate is used here, which is more lax than Uri.IsWellFormedUriString.
 28        /// The reason we use this function is because IsWellFormedUriString will reject valid URIs if they are IPv6 or 
 29        /// </summary>
 30        /// <param name="uriString">The string to check.</param>
 31        /// <param name="uriKind">The type of URI (usually UriKind.Absolute)</param>
 32        /// <param name="result">An out param representing the created URI</param>
 33        /// <returns>True if the URI is valid, false otherwise.</returns>
 34        public static bool TryCreateValidUri(string uriString, UriKind uriKind, out Uri result)
 35        {
 036            return Uri.TryCreate(uriString, uriKind, out result);
 37        }
 38    }
 39}