< Summary

Information
Class: Ice.SliceLoader
Assembly: Ice
File(s): /home/runner/work/ice/ice/csharp/src/Ice/SliceLoader.cs
Tag: 71_18251537082
Line coverage
50%
Covered lines: 1
Uncovered lines: 1
Coverable lines: 2
Total lines: 40
Line coverage: 50%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
50%
Covered methods: 1
Total methods: 2
Method coverage: 50%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
fromAssemblies(...)100%11100%
fromAssembly(...)100%210%

File(s)

/home/runner/work/ice/ice/csharp/src/Ice/SliceLoader.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3#nullable enable
 4
 5using Ice.Internal;
 6using System.Reflection;
 7
 8namespace Ice;
 9
 10/// <summary>Creates class and exception instances from Slice type IDs.</summary>
 11public interface SliceLoader
 12{
 13    /// <summary>Creates an instance of a class mapped from a Slice class or exception based on a Slice type ID.
 14    /// </summary>
 15    /// <param name="typeId">The Slice type ID or compact type ID.</param>
 16    /// <returns>A new instance of the class or exception identified by <paramref name="typeId"/>, or <c>null</c> if the
 17    /// implementation cannot find the corresponding class.</returns>
 18    /// <exception cref="MarshalException">Thrown when the corresponding class was found but its instantiation failed.
 19    /// </exception>
 20    object? newInstance(string typeId);
 21
 22    /// <summary>Retrieves a <see cref="SliceLoader"/> for the generated classes in the specified assemblies.
 23    /// </summary>
 24    /// <param name="assemblies">The assemblies to search.</param>
 25    /// <returns>A Slice loader for the specified assemblies.</returns>
 26    /// <remarks>The classes defined in assemblies referenced by <paramref name="assemblies" /> are included,
 27    /// recursively, provided they contain generated code (as determined by the presence of the
 28    /// <see cref="SliceAttribute" /> attribute).</remarks>
 29    public static SliceLoader fromAssemblies(params Assembly[] assemblies) =>
 130        AssemblySliceLoader.Merge(assemblies.Select(AssemblySliceLoaderFactory.Instance.Get));
 31
 32    /// <summary>Retrieves the <see cref="SliceLoader"/> for the generated classes in the specified assembly.
 33    /// </summary>
 34    /// <param name="assembly">The assembly to search.</param>
 35    /// <returns>A Slice loader for the specified assembly.</returns>
 36    /// <remarks>The classes defined in assemblies referenced by <paramref name="assembly" /> are included, recursively,
 37    /// provided they contain generated code (as determined by the presence of the <see cref="SliceAttribute" />
 38    /// attribute).</remarks>
 039    public static SliceLoader fromAssembly(Assembly assembly) => AssemblySliceLoaderFactory.Instance.Get(assembly);
 40}