< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Xml.Serialization.CodeIdentifierEx
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Xml/Serialization/CodeIdentifierEx.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 33
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
GetCSharpNameStub(...)100%110%
GetCSharpNameByTypeStub(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Xml/Serialization/CodeIdentifierEx.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.Text;
 7using System.Xml.Serialization;
 8using CoreWCF.Runtime;
 9
 10namespace CoreWCF.Xml.Serialization
 11{
 12    internal class CodeIdentifierEx
 13    {
 014        internal static Func<string, string> GetCSharpName { get; private set; } = GetCSharpNameStub;
 015        internal static Func<Type, string> GetCSharpNameByType { get; private set; } = GetCSharpNameByTypeStub;
 16
 17        private static string GetCSharpNameStub(string name)
 18        {
 019            var getCSharpNameMethod = typeof(CodeIdentifier).GetMethod("GetCSharpName", new Type[] { typeof(string) });
 20            Fx.Assert(getCSharpNameMethod != null, "Missing method CodeIdentifier.GetCSharpName(string)");
 021            GetCSharpName = (Func<string, string>)getCSharpNameMethod.CreateDelegate(typeof(Func<string, string>));
 022            return GetCSharpName(name);
 23        }
 24
 25        private static string GetCSharpNameByTypeStub(Type type)
 26        {
 027            var getCSharpNameMethod = typeof(CodeIdentifier).GetMethod("GetCSharpName", new Type[] { typeof(Type) });
 28            Fx.Assert(getCSharpNameMethod != null, "Missing method CodeIdentifier.GetCSharpName(Type)");
 029            GetCSharpNameByType = (Func<Type, string>)getCSharpNameMethod.CreateDelegate(typeof(Func<Type, string>));
 030            return GetCSharpNameByType(type);
 31        }
 32    }
 33}