< Summary - Syki

Information
Class: Syki.Back.Errors.ExamplesProvider<T>
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Errors/ExamplesProvider.cs
Tag: 4_16869239191
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 19
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetExamples()0%4260%

File(s)

/home/runner/work/syki/syki/Back/Errors/ExamplesProvider.cs

#LineLine coverage
 1using System.Reflection;
 2
 3namespace Syki.Back.Errors;
 4
 5public abstract class ExamplesProvider<T> : IMultipleExamplesProvider<T>
 6{
 7    public IEnumerable<SwaggerExample<T>> GetExamples()
 8    {
 09        var method = typeof(T).GetMethod("GetExamples", BindingFlags.Public | BindingFlags.Static);
 10
 011        if (method == null)
 012            throw new InvalidOperationException($"{typeof(T).Name} must have a public static GetExamples() method.");
 13
 014        if (method.Invoke(null, null) is not IEnumerable<(string, T)> examples)
 015            throw new InvalidOperationException($"GetExamples() on {typeof(T).Name} must return IEnumerable<(string, {ty
 16
 017        return examples.Select(e => SwaggerExample.Create(e.Item1, e.Item2));
 18    }
 19}

Methods/Properties

GetExamples()