초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
namespace BrokerTest.Helper;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using Xunit.Abstractions;
public class TestLogger<T> : ILogger<T>, IDisposable
{
private readonly List<string> m_logs = [];
private readonly ITestOutputHelper m_output;
public TestLogger(ITestOutputHelper output)
{
m_output = output;
}
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
{
return null;
}
public bool IsEnabled(LogLevel logLevel) => true;
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception,
Func<TState, Exception?, string> formatter)
{
var message = formatter(state, exception);
m_logs.Add(message);
m_output.WriteLine(message);
}
public IEnumerable<string> Logs => m_logs;
public void Dispose() => m_logs.Clear();
}