< Summary

Information
Class: ZeroC.Slice.UriSliceDecoderExtensions
Assembly: ZeroC.Slice
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/ZeroC.Slice/UriSliceDecoderExtensions.cs
Tag: 275_13775359185
Line coverage
62%
Covered lines: 5
Uncovered lines: 3
Coverable lines: 8
Total lines: 24
Line coverage: 62.5%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Total methods: 1
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
DecodeUri(...)100%1.05162.5%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/ZeroC.Slice/UriSliceDecoderExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3namespace ZeroC.Slice;
 4
 5/// <summary>Provides an extension method for <see cref="SliceDecoder" /> to decode a <c>WellKnownTypes::Uri</c> into a
 6/// <see cref="Uri" />.</summary>
 7public static class UriSliceDecoderExtensions
 8{
 9    /// <summary>Decodes a URI.</summary>
 10    /// <param name="decoder">The Slice decoder.</param>
 11    /// <returns>The URI decoded as a <see cref="Uri"/>.</returns>
 12    public static Uri DecodeUri(this ref SliceDecoder decoder)
 3013    {
 3014        string value = decoder.DecodeString();
 15        try
 3016        {
 3017            return new Uri(value, UriKind.RelativeOrAbsolute);
 18        }
 019        catch (UriFormatException exception)
 020        {
 021            throw new InvalidDataException(message: null, exception);
 22        }
 3023    }
 24}