< Summary

Line coverage
64%
Covered lines: 9
Uncovered lines: 5
Coverable lines: 14
Total lines: 34
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)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/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; }
 199816        public new T? EffectiveDefaultValue { get; }
 17
 18        public JsonParameterInfo(JsonParameterInfoValues parameterInfoValues, JsonPropertyInfo<T> matchingPropertyInfo)
 199819            : base(parameterInfoValues, matchingPropertyInfo)
 199820        {
 199821            Debug.Assert(parameterInfoValues.ParameterType == typeof(T));
 199822            Debug.Assert(!matchingPropertyInfo.IsConfigured);
 23
 199824            if (parameterInfoValues is { HasDefaultValue: true, DefaultValue: object defaultValue })
 025            {
 026                EffectiveDefaultValue = (T)defaultValue;
 027            }
 28
 199829            MatchingProperty = matchingPropertyInfo;
 199830            base.EffectiveDefaultValue = EffectiveDefaultValue;
 199831        }
 32    }
 33}
 34