< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 59
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
.ctor()100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/Common/JsonNamingPolicy.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
 4namespace System.Text.Json
 5{
 6    /// <summary>
 7    /// Determines the naming policy used to convert a string-based name to another format, such as a camel-casing forma
 8    /// </summary>
 9#if BUILDING_SOURCE_GENERATOR
 10    internal
 11#else
 12    public
 13#endif
 14    abstract class JsonNamingPolicy
 15    {
 16        /// <summary>
 17        /// Initializes a new instance of <see cref="JsonNamingPolicy"/>.
 18        /// </summary>
 019        protected JsonNamingPolicy() { }
 20
 21        /// <summary>
 22        /// Returns the naming policy for camel-casing.
 23        /// </summary>
 024        public static JsonNamingPolicy CamelCase { get; } = new JsonCamelCaseNamingPolicy();
 25
 26        /// <summary>
 27        /// Returns the naming policy for lower snake-casing.
 28        /// </summary>
 029        public static JsonNamingPolicy SnakeCaseLower { get; } = new JsonSnakeCaseLowerNamingPolicy();
 30
 31        /// <summary>
 32        /// Returns the naming policy for upper snake-casing.
 33        /// </summary>
 034        public static JsonNamingPolicy SnakeCaseUpper { get; } = new JsonSnakeCaseUpperNamingPolicy();
 35
 36        /// <summary>
 37        /// Returns the naming policy for lower kebab-casing.
 38        /// </summary>
 039        public static JsonNamingPolicy KebabCaseLower { get; } = new JsonKebabCaseLowerNamingPolicy();
 40
 41        /// <summary>
 42        /// Returns the naming policy for upper kebab-casing.
 43        /// </summary>
 044        public static JsonNamingPolicy KebabCaseUpper { get; } = new JsonKebabCaseUpperNamingPolicy();
 45
 46        /// <summary>
 47        /// Returns the naming policy for PascalCasing.
 48        /// </summary>
 049        public static JsonNamingPolicy PascalCase { get; } = new JsonPascalCaseNamingPolicy();
 50
 51        /// <summary>
 52        /// When overridden in a derived class, converts the specified name according to the policy.
 53        /// </summary>
 54        /// <param name="name">The name to convert.</param>
 55        /// <returns>The converted name.</returns>
 56        public abstract string ConvertName(string name);
 57    }
 58}
 59