< Summary

Information
Class: Ice.SliceLoader
Assembly: Ice
File(s): /_/csharp/src/Ice/SliceLoader.cs
Tag: 91_21789722663
Line coverage
50%
Covered lines: 1
Uncovered lines: 1
Coverable lines: 2
Total lines: 45
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)

/_/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>
 11/// Creates class and exception instances from Slice type IDs.
 12/// </summary>
 13public interface SliceLoader
 14{
 15    /// <summary>
 16    /// Creates an instance of a class mapped from a Slice class or exception based on a Slice type ID.
 17    /// </summary>
 18    /// <param name="typeId">The Slice type ID or compact type ID.</param>
 19    /// <returns>A new instance of the class or exception identified by <paramref name="typeId"/>, or <see langword="nul
 20    /// if the implementation cannot find the corresponding class.</returns>
 21    /// <exception cref="MarshalException">Thrown when the corresponding class was found but its instantiation failed.
 22    /// </exception>
 23    object? newInstance(string typeId);
 24
 25    /// <summary>
 26    /// Retrieves a <see cref="SliceLoader" /> for the generated classes in the specified assemblies.
 27    /// </summary>
 28    /// <param name="assemblies">The assemblies to search.</param>
 29    /// <returns>A Slice loader for the specified assemblies.</returns>
 30    /// <remarks>The classes defined in assemblies referenced by <paramref name="assemblies" /> are included,
 31    /// recursively, provided they contain generated code (as determined by the presence of the
 32    /// <see cref="SliceAttribute" /> attribute).</remarks>
 33    public static SliceLoader fromAssemblies(params Assembly[] assemblies) =>
 134        AssemblySliceLoader.Merge(assemblies.Select(AssemblySliceLoaderFactory.Instance.Get));
 35
 36    /// <summary>
 37    /// Retrieves the <see cref="SliceLoader" /> for the generated classes in the specified assembly.
 38    /// </summary>
 39    /// <param name="assembly">The assembly to search.</param>
 40    /// <returns>A Slice loader for the specified assembly.</returns>
 41    /// <remarks>The classes defined in assemblies referenced by <paramref name="assembly" /> are included, recursively,
 42    /// provided they contain generated code (as determined by the presence of the <see cref="SliceAttribute" />
 43    /// attribute).</remarks>
 044    public static SliceLoader fromAssembly(Assembly assembly) => AssemblySliceLoaderFactory.Instance.Get(assembly);
 45}