< Summary

Information
Class: IceRpc.Slice.Ice.IIceObjectService
Assembly: IceRpc.Slice
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Slice/Ice/IIceObjectService.cs
Tag: 275_13775359185
Line coverage
100%
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 59
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage
100%
Covered methods: 3
Total methods: 3
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IceIdsAsync(...)100%44100%
IceIsAAsync(...)100%66100%
IcePingAsync(...)100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Slice/Ice/IIceObjectService.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Features;
 4using System.Diagnostics.CodeAnalysis;
 5using ZeroC.Slice;
 6
 7namespace IceRpc.Slice.Ice;
 8
 9/// <remarks>The IceRpc + Slice integration provides a default implementation for all methods of this interface.
 10/// </remarks>
 11[SuppressMessage(
 12    "StyleCop.CSharp.DocumentationRules",
 13    "SA1605:PartialElementDocumentationMustHaveSummary",
 14    Justification = "Use generated summary.")]
 15public partial interface IIceObjectService
 16{
 17    /// <summary>Gets the Slice type IDs of all the interfaces implemented by the target service.</summary>
 18    /// <param name="features">The dispatch features.</param>
 19    /// <param name="cancellationToken">A cancellation token that receives the cancellation requests.</param>
 20    /// <returns>The Slice type IDs of all these interfaces, sorted alphabetically.</returns>
 21    public ValueTask<IEnumerable<string>> IceIdsAsync(IFeatureCollection features, CancellationToken cancellationToken)
 222    {
 223        var sortedSet = new SortedSet<string>(StringComparer.Ordinal);
 1824        foreach (Type type in GetType().GetInterfaces())
 625        {
 626            if (type.GetSliceTypeId() is string typeId)
 427            {
 428                sortedSet.Add(typeId);
 429            }
 630        }
 231        return new(sortedSet);
 232    }
 33
 34    /// <summary>Tests whether the target service implements the specified interface.</summary>
 35    /// <param name="id">The Slice type ID of the interface to test against.</param>
 36    /// <param name="features">The dispatch features.</param>
 37    /// <param name="cancellationToken">A cancellation token that receives the cancellation requests.</param>
 38    /// <returns>True when the target service implements this interface; otherwise, false.</returns>
 39    public ValueTask<bool> IceIsAAsync(
 40        string id,
 41        IFeatureCollection features,
 42        CancellationToken cancellationToken)
 843    {
 5744        foreach (Type type in GetType().GetInterfaces())
 1945        {
 1946            if (type.GetSliceTypeId() is string typeId && typeId == id)
 547            {
 548                return new(true);
 49            }
 1450        }
 351        return new(false);
 852    }
 53
 54    /// <summary>Pings the service.</summary>
 55    /// <param name="features">The dispatch features.</param>
 56    /// <param name="cancellationToken">A cancellation token that receives the cancellation requests.</param>
 57    /// <returns>A value task that completes when this implementation completes.</returns>
 258    public ValueTask IcePingAsync(IFeatureCollection features, CancellationToken cancellationToken) => default;
 59}