< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.ActionOfStreamBodyWriter
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Channels/ActionOfStreamBodyWriter.cs
Line coverage
87%
Covered lines: 7
Uncovered lines: 1
Coverable lines: 8
Total lines: 34
Line coverage: 87.5%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
OnWriteBodyContents(...)100%11100%
CreateStreamBodyWriter(...)50%2266.66%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Channels/ActionOfStreamBodyWriter.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.IO;
 6
 7namespace CoreWCF.Channels
 8{
 9    internal class ActionOfStreamBodyWriter : StreamBodyWriter
 10    {
 11        private readonly Action<Stream> _actionOfStream;
 12
 13        public ActionOfStreamBodyWriter(Action<Stream> actionOfStream)
 414            : base(false)
 15        {
 416            _actionOfStream = actionOfStream;
 417        }
 18
 19        protected override void OnWriteBodyContents(Stream stream)
 20        {
 421            _actionOfStream(stream);
 422        }
 23
 24        internal static StreamBodyWriter CreateStreamBodyWriter(Action<Stream> streamAction)
 25        {
 426            if (streamAction == null)
 27            {
 028                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(streamAction));
 29            }
 30
 431            return new ActionOfStreamBodyWriter(streamAction);
 32        }
 33    }
 34}