< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.MapMiddleware
Assembly: CoreWCF.NetFramingBase
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetFramingBase/src/CoreWCF/Configuration/MapMiddleware.cs
Line coverage
90%
Covered lines: 9
Uncovered lines: 1
Coverable lines: 10
Total lines: 51
Line coverage: 90%
Branch coverage
62%
Covered branches: 5
Total branches: 8
Branch coverage: 62.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)50%44100%
Invoke()75%4483.33%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetFramingBase/src/CoreWCF/Configuration/MapMiddleware.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.Threading.Tasks;
 6using CoreWCF.Channels.Framing;
 7
 8namespace CoreWCF.Configuration
 9{
 10    /// <summary>
 11    /// Represents a middleware that maps a request path to a sub-request pipeline.
 12    /// </summary>
 13    public class MapMiddleware
 14    {
 15        private readonly HandshakeDelegate _next;
 16        private readonly MapOptions _options;
 17
 18        /// <summary>
 19        /// Creates a new instance of <see cref="MapMiddleware"/>.
 20        /// </summary>
 21        /// <param name="next">The delegate representing the next middleware in the request pipeline.</param>
 22        /// <param name="options">The middleware options.</param>
 16623        public MapMiddleware(HandshakeDelegate next, MapOptions options)
 24        {
 16625            _next = next ?? throw new ArgumentNullException(nameof(next));
 16626            _options = options ?? throw new ArgumentNullException(nameof(options));
 16627        }
 28
 29        /// <summary>
 30        /// Executes the middleware.
 31        /// </summary>
 32        /// <param name="context">The <see cref="HttpContext"/> for the current request.</param>
 33        /// <returns>A task that represents the execution of this middleware.</returns>
 34        public async Task Invoke(FramingConnection connection)
 35        {
 16536            if (connection == null)
 37            {
 038                throw new ArgumentNullException(nameof(connection));
 39            }
 40
 16541            if (_options.Predicate(connection))
 42            {
 11543                await _options.Branch(connection);
 44            }
 45            else
 46            {
 5047                await _next(connection);
 48            }
 16449        }
 50    }
 51}