< Summary

Class:Azure.AI.FormRecognizer.Models.LengthUnitExtensions
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\LengthUnit.Serialization.cs
Covered lines:2
Uncovered lines:7
Coverable lines:9
Total lines:28
Line coverage:22.2% (2 of 9)
Covered branches:3
Total branches:8
Branch coverage:37.5% (3 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ToSerialString(...)-0%0%
ToLengthUnit(...)-66.67%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\LengthUnit.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9
 10namespace Azure.AI.FormRecognizer.Models
 11{
 12    internal static class LengthUnitExtensions
 13    {
 014        public static string ToSerialString(this LengthUnit value) => value switch
 015        {
 016            LengthUnit.Pixel => "pixel",
 017            LengthUnit.Inch => "inch",
 018            _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown LengthUnit value.")
 019        };
 20
 21        public static LengthUnit ToLengthUnit(this string value)
 22        {
 27623            if (string.Equals(value, "pixel", StringComparison.InvariantCultureIgnoreCase)) return LengthUnit.Pixel;
 31224            if (string.Equals(value, "inch", StringComparison.InvariantCultureIgnoreCase)) return LengthUnit.Inch;
 025            throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown LengthUnit value.");
 26        }
 27    }
 28}