< Summary - CoreWCF Coverage — PR #1766

Information
Class: Microsoft.AspNetCore.Hosting.WebHostExtensions
Assembly: UnitTests.Common
File(s): /home/runner/work/CoreWCF/CoreWCF/src/Common/UnitTests.Common/Helpers/WebHostExtensions.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 32
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
GetHttpPort(...)100%11100%
GetHttpsPort(...)100%11100%
GetHttpBaseAddressUri(...)50%22100%
GetHttpsBaseAddressUri(...)50%22100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/Common/UnitTests.Common/Helpers/WebHostExtensions.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;
 5using System.Linq;
 6using Microsoft.AspNetCore.Hosting.Server.Features;
 7
 8namespace Microsoft.AspNetCore.Hosting
 9{
 10    public static class WebHostExtensions
 11    {
 26712        public static int GetHttpPort(this IWebHost webHost) => webHost.GetHttpBaseAddressUri().Port;
 13
 2714        public static int GetHttpsPort(this IWebHost webHost) => webHost.GetHttpsBaseAddressUri().Port;
 15
 16        public static Uri GetHttpBaseAddressUri(this IWebHost webHost)
 17        {
 87318            Uri uri = webHost.ServerFeatures.Get<IServerAddressesFeature>().Addresses.Select(static address => new Uri(a
 29119            return uri != null
 29120                ? uri
 29121                : throw new NotSupportedException();
 22        }
 23
 24        public static Uri GetHttpsBaseAddressUri(this IWebHost webHost)
 25        {
 8626            Uri uri = webHost.ServerFeatures.Get<IServerAddressesFeature>().Addresses.Select(static address => new Uri(a
 2827            return uri != null
 2828                ? uri
 2829                : throw new NotSupportedException();
 30        }
 31    }
 32}