< Summary

Information
Class: Elsa.Testing.Shared.XunitLogger
Assembly: Elsa.Testing.Shared
File(s): /home/runner/work/elsa-core/elsa-core/src/common/Elsa.Testing.Shared/XunitLogger.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 29
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
BeginScope(...)100%210%
IsEnabled(...)100%210%
Log(...)0%620%
.cctor()100%210%
Dispose()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/common/Elsa.Testing.Shared/XunitLogger.cs

#LineLine coverage
 1using Microsoft.Extensions.Logging;
 2using Xunit.Abstractions;
 3
 4namespace Elsa.Testing.Shared;
 5
 06public class XunitLogger(ITestOutputHelper testOutputHelper, string categoryName) : ILogger
 7{
 08    public IDisposable BeginScope<TState>(TState state) where TState : notnull => NoopDisposable.Instance;
 9
 10    public bool IsEnabled(LogLevel logLevel)
 011        => true;
 12
 13    public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Excepti
 14    {
 015        testOutputHelper.WriteLine($"{categoryName} [{eventId}] {formatter(state, exception)}");
 16
 017        if (exception != null)
 018            testOutputHelper.WriteLine(exception.ToString());
 019    }
 20
 21    private class NoopDisposable : IDisposable
 22    {
 023        public static readonly NoopDisposable Instance = new();
 24
 25        public void Dispose()
 26        {
 027        }
 28    }
 29}