< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 40
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/src/System/Text/Json/Serialization/Metadata/JsonUnionCaseInfo.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.Serialization.Metadata
 5{
 6    /// <summary>
 7    /// Represents metadata for a single case type within a union type.
 8    /// </summary>
 9    public sealed class JsonUnionCaseInfo
 10    {
 11        /// <summary>
 12        /// Initializes a new instance of <see cref="JsonUnionCaseInfo"/> with the specified case type.
 13        /// </summary>
 14        /// <param name="caseType">The type representing this union case.</param>
 15        /// <exception cref="ArgumentNullException"><paramref name="caseType"/> is <see langword="null"/>.</exception>
 016        public JsonUnionCaseInfo(Type caseType)
 017        {
 018            ArgumentNullException.ThrowIfNull(caseType);
 019            CaseType = caseType;
 020        }
 21
 22        /// <summary>
 23        /// Gets the type representing this union case.
 24        /// </summary>
 025        public Type CaseType { get; }
 26
 27        /// <summary>
 28        /// Gets a value indicating whether this case can hold a <see langword="null"/> value.
 29        /// </summary>
 30        /// <remarks>
 31        /// Set to <see langword="true"/> when the union constructor parameter for this case
 32        /// was declared as a nullable reference type or as <see cref="Nullable{T}"/>.
 33        /// When a JSON <see langword="null"/> is encountered during deserialization,
 34        /// the first union case whose <see cref="IsNullable"/> is <see langword="true"/>
 35        /// is selected and its case constructor is invoked with <see langword="null"/>.
 36        /// </remarks>
 037        public bool IsNullable { get; init; }
 38    }
 39}
 40