< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Dispatcher.WebFaultFormatter
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Dispatcher/WebFaultFormatter.cs
Line coverage
31%
Covered lines: 6
Uncovered lines: 13
Coverable lines: 19
Total lines: 61
Line coverage: 31.5%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
Serialize(...)0%2233.33%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Dispatcher/WebFaultFormatter.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.Collections.Generic;
 6using System.Globalization;
 7using System.Runtime.Serialization;
 8using CoreWCF.Channels;
 9using CoreWCF.Runtime;
 10
 11namespace CoreWCF.Dispatcher
 12{
 13    internal class WebFaultFormatter : IDispatchFaultFormatter, IDispatchFaultFormatterWrapper
 14    {
 15        private static MessageFault s_defaultMessageFault;
 16
 16317        internal WebFaultFormatter(IDispatchFaultFormatter faultFormatter)
 18        {
 16319            InnerFaultFormatter = faultFormatter;
 16320        }
 21
 22        public MessageFault Serialize(FaultException faultException, out string action)
 23        {
 24            try
 25            {
 226                return InnerFaultFormatter.Serialize(faultException, out action);
 27            }
 28            catch (Exception e)
 29            {
 030                if (Fx.IsFatal(e))
 31                {
 032                    throw;
 33                }
 34
 035                action = null;
 036                return Default;
 37            }
 238        }
 39
 16540        public IDispatchFaultFormatter InnerFaultFormatter { get; set; }
 41
 42        private static MessageFault Default
 43        {
 44            get
 45            {
 046                if (s_defaultMessageFault == null)
 47                {
 048                    s_defaultMessageFault = MessageFault.CreateFault(
 049                        new FaultCode("Default"),
 050                        new FaultReason(""),
 051                        null,
 052                        null,
 053                        "",
 054                        "");
 55                }
 56
 057                return s_defaultMessageFault;
 58            }
 59        }
 60    }
 61}