mirror of
https://github.com/bitwarden/server
synced 2025-12-12 22:33:45 +00:00
Xunit v3 (#6241)
* Initial v3 Migration * Migrate tests and debug duplicate ids * Debug duplicate ids * Support seeding * remove seeder * Upgrade to latest XUnit.v3 version * Remove Theory changes for now * Remove Theory change from DeviceRepositoryTests * Remove cancellation token additions
This commit is contained in:
47
test/Infrastructure.IntegrationTest/XUnitLoggerProvider.cs
Normal file
47
test/Infrastructure.IntegrationTest/XUnitLoggerProvider.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Infrastructure.IntegrationTest;
|
||||
|
||||
public sealed class XUnitLoggerProvider : ILoggerProvider
|
||||
{
|
||||
public ILogger CreateLogger(string categoryName)
|
||||
{
|
||||
return new XUnitLogger(categoryName);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private class XUnitLogger : ILogger
|
||||
{
|
||||
private readonly string _categoryName;
|
||||
|
||||
public XUnitLogger(string categoryName)
|
||||
{
|
||||
_categoryName = categoryName;
|
||||
}
|
||||
|
||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsEnabled(LogLevel logLevel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
|
||||
{
|
||||
if (TestContext.Current?.TestOutputHelper is not ITestOutputHelper testOutputHelper)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
testOutputHelper.WriteLine($"[{_categoryName}] {formatter(state, exception)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user