mirror of
https://github.com/bitwarden/server
synced 2025-12-14 15:23:42 +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:
@@ -1,32 +1,17 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Infrastructure.IntegrationTest;
|
||||
|
||||
[Obsolete("This attribute is no longer needed and can be replaced with a [Theory]")]
|
||||
public class DatabaseTheoryAttribute : TheoryAttribute
|
||||
{
|
||||
private static IConfiguration? _cachedConfiguration;
|
||||
|
||||
public DatabaseTheoryAttribute()
|
||||
{
|
||||
if (!HasAnyDatabaseSetup())
|
||||
{
|
||||
Skip = "No databases setup.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static bool HasAnyDatabaseSetup()
|
||||
public DatabaseTheoryAttribute([CallerFilePath] string? sourceFilePath = null, [CallerLineNumber] int sourceLineNumber = -1) : base(sourceFilePath, sourceLineNumber)
|
||||
{
|
||||
var config = GetConfiguration();
|
||||
return config.GetDatabases().Length > 0;
|
||||
}
|
||||
|
||||
public static IConfiguration GetConfiguration()
|
||||
{
|
||||
return _cachedConfiguration ??= new ConfigurationBuilder()
|
||||
.AddUserSecrets<DatabaseDataAttribute>(optional: true, reloadOnChange: false)
|
||||
.AddEnvironmentVariables("BW_TEST_")
|
||||
.AddCommandLine(Environment.GetCommandLineArgs())
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user