< 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: 701_22528036593
Line coverage
100%
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 62
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    [SliceOperation("ice_ids", Idempotent = true)]
 22    public ValueTask<IEnumerable<string>> IceIdsAsync(IFeatureCollection features, CancellationToken cancellationToken)
 223    {
 224        var sortedSet = new SortedSet<string>(StringComparer.Ordinal);
 1825        foreach (Type type in GetType().GetInterfaces())
 626        {
 627            if (type.GetSliceTypeId() is string typeId)
 428            {
 429                sortedSet.Add(typeId);
 430            }
 631        }
 232        return new(sortedSet);
 233    }
 34
 35    /// <summary>Tests whether the target service implements the specified interface.</summary>
 36    /// <param name="id">The Slice type ID of the interface to test against.</param>
 37    /// <param name="features">The dispatch features.</param>
 38    /// <param name="cancellationToken">A cancellation token that receives the cancellation requests.</param>
 39    /// <returns>True when the target service implements this interface; otherwise, false.</returns>
 40    [SliceOperation("ice_isA", Idempotent = true)]
 41    public ValueTask<bool> IceIsAAsync(
 42        string id,
 43        IFeatureCollection features,
 44        CancellationToken cancellationToken)
 845    {
 5746        foreach (Type type in GetType().GetInterfaces())
 1947        {
 1948            if (type.GetSliceTypeId() is string typeId && typeId == id)
 549            {
 550                return new(true);
 51            }
 1452        }
 353        return new(false);
 854    }
 55
 56    /// <summary>Pings the service.</summary>
 57    /// <param name="features">The dispatch features.</param>
 58    /// <param name="cancellationToken">A cancellation token that receives the cancellation requests.</param>
 59    /// <returns>A value task that completes when this implementation completes.</returns>
 60    [SliceOperation("ice_ping", Idempotent = true)]
 261    public ValueTask IcePingAsync(IFeatureCollection features, CancellationToken cancellationToken) => default;
 62}