< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Dispatcher.XmlFormatMapping
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Dispatcher/XmlFormatMapping.cs
Line coverage
50%
Covered lines: 7
Uncovered lines: 7
Coverable lines: 14
Total lines: 45
Line coverage: 50%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Dispatcher/XmlFormatMapping.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.Collections.Generic;
 5using System.Text;
 6using CoreWCF.Channels;
 7using CoreWCF.Web;
 8
 9namespace CoreWCF.Dispatcher
 10{
 11    internal class XmlFormatMapping : MultiplexingFormatMapping
 12    {
 113        public static readonly WebContentFormat WebContentFormat = WebContentFormat.Xml;
 14
 115        internal static readonly string s_defaultMediaType = "application/xml";
 116        private static readonly Dictionary<Encoding, MessageEncoder> s_encoders = new Dictionary<Encoding, MessageEncode
 117        private static readonly object s_thisLock = new object();
 18
 19        public XmlFormatMapping(Encoding writeEncoding, WebContentTypeMapper contentTypeMapper)
 3720            : base(writeEncoding, contentTypeMapper)
 3721        { }
 22
 023        public override WebContentFormat ContentFormat => WebContentFormat;
 24
 025        public override WebMessageFormat MessageFormat => WebMessageFormat.Xml;
 26
 3727        public override string DefaultMediaType => s_defaultMediaType;
 28
 29        protected override MessageEncoder Encoder
 30        {
 31            get
 32            {
 033                lock (s_thisLock)
 34                {
 035                    if (!s_encoders.ContainsKey(writeEncoding))
 36                    {
 037                        s_encoders[writeEncoding] = new TextMessageEncodingBindingElement(MessageVersion.None, writeEnco
 38                    }
 039                }
 40
 041                return s_encoders[writeEncoding];
 42            }
 43        }
 44    }
 45}