< Summary

Information
Class: System.Text.Json.Serialization.Metadata.JsonParameterInfo<T>
Assembly: System.Text.Json
File(s): C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Metadata\JsonParameterInfoOfT.cs
Line coverage
64%
Covered lines: 9
Uncovered lines: 5
Coverable lines: 14
Total lines: 33
Line coverage: 64.2%
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
.ctor(...)66.66%6672.72%

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Metadata\JsonParameterInfoOfT.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.Diagnostics;
 5
 6namespace System.Text.Json.Serialization.Metadata
 7{
 8    /// <summary>
 9    /// Represents a strongly-typed parameter to prevent boxing where have less than 4 parameters.
 10    /// Holds relevant state like the default value of the parameter, and the position in the method's parameter list.
 11    /// </summary>
 12    internal sealed class JsonParameterInfo<T> : JsonParameterInfo
 13    {
 014        public new JsonConverter<T> EffectiveConverter => MatchingProperty.EffectiveConverter;
 015        public new JsonPropertyInfo<T> MatchingProperty { get; }
 449416        public new T? EffectiveDefaultValue { get; }
 17
 18        public JsonParameterInfo(JsonParameterInfoValues parameterInfoValues, JsonPropertyInfo<T> matchingPropertyInfo)
 449419            : base(parameterInfoValues, matchingPropertyInfo)
 449420        {
 449421            Debug.Assert(parameterInfoValues.ParameterType == typeof(T));
 449422            Debug.Assert(!matchingPropertyInfo.IsConfigured);
 23
 449424            if (parameterInfoValues is { HasDefaultValue: true, DefaultValue: object defaultValue })
 025            {
 026                EffectiveDefaultValue = (T)defaultValue;
 027            }
 28
 449429            MatchingProperty = matchingPropertyInfo;
 449430            base.EffectiveDefaultValue = EffectiveDefaultValue;
 449431        }
 32    }
 33}