Browse Source

Test xUnit Fix

xunit-v3-migration
Justin Baur 1 year ago
parent
commit
e0b5937d80
No known key found for this signature in database
  1. 4
      test/Infrastructure.IntegrationTest/DatabaseDataAttribute.cs
  2. 4
      test/Infrastructure.IntegrationTest/Infrastructure.IntegrationTest.csproj
  3. 1
      test/Infrastructure.IntegrationTest/Utilities/DefaultCustomizerAttribute.cs
  4. 2
      test/Infrastructure.IntegrationTest/Utilities/ServiceProviderTheoryDataRow.cs

4
test/Infrastructure.IntegrationTest/DatabaseDataAttribute.cs

@ -1,6 +1,5 @@ @@ -1,6 +1,5 @@
using System.Reflection;
using Bit.Infrastructure.IntegrationTest.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Sdk;
using Xunit.v3;
@ -47,8 +46,7 @@ public class DatabaseDataAttribute : DataAttribute @@ -47,8 +46,7 @@ public class DatabaseDataAttribute : DataAttribute
}
theory
.WithTrait("Type", customizationContext.Database.Type.ToString())
.WithTrait("ConnectionString", customizationContext.Database.ConnectionString ?? "(none)")
.WithTrait("DbType", customizationContext.Database.Type.ToString())
.WithTestDisplayName($"{testMethod.Name}[{customizationContext.Database.Name ?? customizationContext.Database.Type.ToString()}]");
theories[i] = theory;

4
test/Infrastructure.IntegrationTest/Infrastructure.IntegrationTest.csproj

@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
<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="0.6.0-pre.7" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0-pre.49">
<PackageReference Include="xunit.v3" Version="0.7.0-pre.19" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0-pre.54">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

1
test/Infrastructure.IntegrationTest/Utilities/DefaultCustomizerAttribute.cs

@ -6,7 +6,6 @@ using Bit.Infrastructure.EntityFramework; @@ -6,7 +6,6 @@ using Bit.Infrastructure.EntityFramework;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using MySqlConnector;
namespace Bit.Infrastructure.IntegrationTest.Utilities;

2
test/Infrastructure.IntegrationTest/Utilities/ServiceProviderTheoryDataRow.cs

@ -20,6 +20,7 @@ public class ServiceTheoryDataRow : TheoryDataRowBase @@ -20,6 +20,7 @@ public class ServiceTheoryDataRow : TheoryDataRowBase
protected override object?[] GetData()
{
Console.WriteLine($"Traits:\n{Traits.Select((k, v) => $"{k}: {string.Join(", ", v)}\n")}");
var parameters = _testMethod.GetParameters();
var sp = _customizationContext.Services.BuildServiceProvider();
@ -35,6 +36,7 @@ public class ServiceTheoryDataRow : TheoryDataRowBase @@ -35,6 +36,7 @@ public class ServiceTheoryDataRow : TheoryDataRowBase
}
_disposalTracker.Add(scope);
_disposalTracker.Add(sp);
return objects;
}

Loading…
Cancel
Save