< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Xml.XmlDictionaryWriterExtensions
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Xml/XmlDictionaryWriterExtensions.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 23
Line coverage: 100%
Branch coverage
66%
Covered branches: 4
Total branches: 6
Branch coverage: 66.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
SupportsAsync(...)66.66%66100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Xml/XmlDictionaryWriterExtensions.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.Xml;
 6
 7namespace CoreWCF.Xml
 8{
 9    internal static class XmlDictionaryWriterExtensions
 10    {
 311        private static readonly bool s_frameworkSupportsAsyncWriteOperations = Environment.Version.Major >= 6;
 12
 13        internal static bool SupportsAsync(this XmlDictionaryWriter writer)
 14        {
 15            // Unfortunately not every XmlWriter supports asynchronous IO.
 16            // And there's no easy API to check for this.
 17            //
 18            // writer.Settings.Async is often null, so also not reliable
 87219            return s_frameworkSupportsAsyncWriteOperations &&
 87220                (writer is IAsyncXmlWriter || (writer.Settings?.Async ?? false));
 21        }
 22    }
 23}