From e0b5937d80eb2e8d3cdc745fc74ff1958be8a289 Mon Sep 17 00:00:00 2001 From: Justin Baur <19896123+justindbaur@users.noreply.github.com> Date: Fri, 6 Dec 2024 20:31:45 -0500 Subject: [PATCH] Test xUnit Fix --- test/Infrastructure.IntegrationTest/DatabaseDataAttribute.cs | 4 +--- .../Infrastructure.IntegrationTest.csproj | 4 ++-- .../Utilities/DefaultCustomizerAttribute.cs | 1 - .../Utilities/ServiceProviderTheoryDataRow.cs | 2 ++ 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/Infrastructure.IntegrationTest/DatabaseDataAttribute.cs b/test/Infrastructure.IntegrationTest/DatabaseDataAttribute.cs index d9a44e3b90..5171cc0691 100644 --- a/test/Infrastructure.IntegrationTest/DatabaseDataAttribute.cs +++ b/test/Infrastructure.IntegrationTest/DatabaseDataAttribute.cs @@ -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 } 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; diff --git a/test/Infrastructure.IntegrationTest/Infrastructure.IntegrationTest.csproj b/test/Infrastructure.IntegrationTest/Infrastructure.IntegrationTest.csproj index 458eeecd1b..576c413135 100644 --- a/test/Infrastructure.IntegrationTest/Infrastructure.IntegrationTest.csproj +++ b/test/Infrastructure.IntegrationTest/Infrastructure.IntegrationTest.csproj @@ -13,8 +13,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/Infrastructure.IntegrationTest/Utilities/DefaultCustomizerAttribute.cs b/test/Infrastructure.IntegrationTest/Utilities/DefaultCustomizerAttribute.cs index 895fa65aa5..30649a9f0c 100644 --- a/test/Infrastructure.IntegrationTest/Utilities/DefaultCustomizerAttribute.cs +++ b/test/Infrastructure.IntegrationTest/Utilities/DefaultCustomizerAttribute.cs @@ -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; diff --git a/test/Infrastructure.IntegrationTest/Utilities/ServiceProviderTheoryDataRow.cs b/test/Infrastructure.IntegrationTest/Utilities/ServiceProviderTheoryDataRow.cs index 1e758e847e..2bde1ebd1f 100644 --- a/test/Infrastructure.IntegrationTest/Utilities/ServiceProviderTheoryDataRow.cs +++ b/test/Infrastructure.IntegrationTest/Utilities/ServiceProviderTheoryDataRow.cs @@ -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 } _disposalTracker.Add(scope); + _disposalTracker.Add(sp); return objects; }