mirror of
https://github.com/bitwarden/server
synced 2025-12-27 21:53:24 +00:00
XUnit.v3 Upgrade
This commit is contained in:
@@ -5,6 +5,7 @@ using Bit.Infrastructure.Dapper;
|
||||
using Bit.Infrastructure.EntityFramework;
|
||||
using Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using Bit.Infrastructure.IntegrationTest.Services;
|
||||
using Bit.Test.Common;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -183,7 +184,7 @@ public class DatabaseDataAttribute : DataAttribute
|
||||
|
||||
public override bool SupportsDiscoveryEnumeration()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private class ServiceBasedTheoryDataRow : TheoryDataRowBase
|
||||
|
||||
@@ -11,12 +11,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.10.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||
<PackageReference Include="xunit.v3" Version="3.0.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="$(CoverletCollectorVersion)">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
@@ -30,6 +25,7 @@
|
||||
<ProjectReference Include="..\..\util\MySqlMigrations\MySqlMigrations.csproj" />
|
||||
<ProjectReference Include="..\..\util\PostgresMigrations\PostgresMigrations.csproj" />
|
||||
<ProjectReference Include="..\..\util\SqliteMigrations\SqliteMigrations.csproj" />
|
||||
<ProjectReference Include="..\Common\Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
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