< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.MapExtensions
Assembly: CoreWCF.NetFramingBase
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetFramingBase/src/CoreWCF/Configuration/MapExtensions.cs
Line coverage
80%
Covered lines: 12
Uncovered lines: 3
Coverable lines: 15
Total lines: 52
Line coverage: 80%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
Map(...)50%6680%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetFramingBase/src/CoreWCF/Configuration/MapExtensions.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 CoreWCF.Channels.Framing;
 6
 7namespace CoreWCF.Configuration
 8{
 9    /// <summary>
 10    /// Extension methods for the <see cref="MapMiddleware"/>.
 11    /// </summary>
 12    public static class MapExtensions
 13    {
 14        /// <summary>
 15        /// Branches the handshake pipeline based on the result of a predicate.
 16        /// If the predicate returns true the branch is executed.
 17        /// </summary>
 18        /// <param name="handshakeBuilder">The <see cref="IFramingConnectionHandshakeBuilder"/> instance.</param>
 19        /// <param name="predicate">The request path to match.</param>
 20        /// <param name="configuration">The branch to take for positive path matches.</param>
 21        /// <returns>The <see cref="IFramingConnectionHandshakeBuilder"/> instance.</returns>
 22        public static IFramingConnectionHandshakeBuilder Map(this IFramingConnectionHandshakeBuilder handshakeBuilder, F
 23        {
 16624            if (handshakeBuilder == null)
 25            {
 026                throw new ArgumentNullException(nameof(handshakeBuilder));
 27            }
 28
 16629            if (configuration == null)
 30            {
 031                throw new ArgumentNullException(nameof(configuration));
 32            }
 33
 16634            if (predicate == null)
 35            {
 036                throw new ArgumentNullException(nameof(predicate));
 37            }
 38
 39            // create branch
 16640            IFramingConnectionHandshakeBuilder branchBuilder = handshakeBuilder.New();
 16641            configuration(branchBuilder);
 16642            HandshakeDelegate branch = branchBuilder.Build();
 43
 16644            var options = new MapOptions
 16645            {
 16646                Branch = branch,
 16647                Predicate = predicate,
 16648            };
 33249            return handshakeBuilder.Use(next => new MapMiddleware(next, options).Invoke);
 50        }
 51    }
 52}