From 11146f84f7609c45e52f7229885a5d3a3794c6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Sun, 31 May 2026 09:27:24 +0200 Subject: [PATCH] refactor: remove ExcludeFrameworkAssemblies method from tests and update aweXpect.Core version to 2.32.0 --- Directory.Packages.props | 2 +- ...ilters.WhichHaveDependenciesOnlyOn.Tests.cs | 16 ---------------- Tests/aweXpect.Reflection.Tests/InTests.cs | 2 +- ...tAssemblies.HaveDependenciesOnlyOn.Tests.cs | 18 ------------------ ...ThatAssembly.HasDependenciesOnlyOn.Tests.cs | 18 ------------------ 5 files changed, 2 insertions(+), 54 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 7487f76d..86545054 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ - + diff --git a/Tests/aweXpect.Reflection.Tests/Filters/AssemblyFilters.WhichHaveDependenciesOnlyOn.Tests.cs b/Tests/aweXpect.Reflection.Tests/Filters/AssemblyFilters.WhichHaveDependenciesOnlyOn.Tests.cs index 1309e97d..65d3332a 100644 --- a/Tests/aweXpect.Reflection.Tests/Filters/AssemblyFilters.WhichHaveDependenciesOnlyOn.Tests.cs +++ b/Tests/aweXpect.Reflection.Tests/Filters/AssemblyFilters.WhichHaveDependenciesOnlyOn.Tests.cs @@ -8,16 +8,6 @@ public sealed partial class AssemblyFilters { public sealed class WhichHaveDependenciesOnlyOn { - /// - /// Excludes the framework facade assemblies that differ between target frameworks (e.g. netstandard on - /// net48), so that the tests only have to whitelist the actual non-framework dependencies. - /// - private static CustomizationLifetime ExcludeFrameworkAssemblies() - => Customize.aweXpect.Reflection().ExcludedAssemblyPrefixes - .Set([ - .. Customize.aweXpect.Reflection().ExcludedAssemblyPrefixes.Get(), "netstandard", "WindowsBase", - ]); - public sealed class Tests { [Fact] @@ -45,8 +35,6 @@ await That(assemblies.GetDescription()) [Fact] public async Task ShouldFilterForAssembliesDependingOnlyOnAllowed() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Filtered.Assemblies assemblies = In.Assemblies(typeof(In).Assembly) .WhichHaveDependenciesOnlyOn("aweXpect.Core"); @@ -56,8 +44,6 @@ public async Task ShouldFilterForAssembliesDependingOnlyOnAllowed() [Fact] public async Task ShouldSupportAsWildcard() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Filtered.Assemblies assemblies = In.Assemblies(typeof(In).Assembly) .WhichHaveDependenciesOnlyOn("aweXpect.*").AsWildcard(); @@ -67,8 +53,6 @@ public async Task ShouldSupportAsWildcard() [Fact] public async Task ShouldSupportIgnoringCase() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Filtered.Assemblies assemblies = In.Assemblies(typeof(In).Assembly) .WhichHaveDependenciesOnlyOn("awexpect.core").IgnoringCase(); diff --git a/Tests/aweXpect.Reflection.Tests/InTests.cs b/Tests/aweXpect.Reflection.Tests/InTests.cs index 2601d885..75774d20 100644 --- a/Tests/aweXpect.Reflection.Tests/InTests.cs +++ b/Tests/aweXpect.Reflection.Tests/InTests.cs @@ -13,7 +13,7 @@ public async Task AllLoadedAssemblies_ShouldContainMultipleAssemblies() { Filtered.Assemblies sut = In.AllLoadedAssemblies(); - await That(sut).HasCount().AtLeast(5); + await That(sut).HasCount().AtLeast(4); await That(sut).All().Satisfy(x => !x.FullName!.StartsWith("System.")); await That(sut.GetDescription()).IsEqualTo("in all loaded assemblies"); } diff --git a/Tests/aweXpect.Reflection.Tests/ThatAssemblies.HaveDependenciesOnlyOn.Tests.cs b/Tests/aweXpect.Reflection.Tests/ThatAssemblies.HaveDependenciesOnlyOn.Tests.cs index 9f686414..910faf9b 100644 --- a/Tests/aweXpect.Reflection.Tests/ThatAssemblies.HaveDependenciesOnlyOn.Tests.cs +++ b/Tests/aweXpect.Reflection.Tests/ThatAssemblies.HaveDependenciesOnlyOn.Tests.cs @@ -9,23 +9,11 @@ public sealed partial class ThatAssemblies { public sealed class HaveDependenciesOnlyOn { - /// - /// Excludes the framework facade assemblies that differ between target frameworks (e.g. netstandard on - /// net48), so that the tests only have to whitelist the actual non-framework dependencies. - /// - private static CustomizationLifetime ExcludeFrameworkAssemblies() - => Customize.aweXpect.Reflection().ExcludedAssemblyPrefixes - .Set([ - .. Customize.aweXpect.Reflection().ExcludedAssemblyPrefixes.Get(), "netstandard", "WindowsBase", - ]); - public sealed class Tests { [Fact] public async Task WhenAllAssembliesDependOnlyOnAllowed_ShouldSucceed() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Filtered.Assemblies subject = In.Assemblies(typeof(In).Assembly); async Task Act() @@ -39,8 +27,6 @@ async Task Act() [Fact] public async Task WhenAllowedMatchesAsWildcard_ShouldSucceed() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Filtered.Assemblies subject = In.Assemblies(typeof(In).Assembly); async Task Act() @@ -54,8 +40,6 @@ async Task Act() [Fact] public async Task WhenAnAssemblyDependsOnDisallowedAssembly_ShouldFail() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Filtered.Assemblies subject = In.AssemblyContaining(); async Task Act() @@ -79,8 +63,6 @@ public sealed class NegatedTests [Fact] public async Task WhenAllAssembliesDependOnlyOnAllowed_ShouldFail() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Filtered.Assemblies subject = In.Assemblies(typeof(In).Assembly); async Task Act() diff --git a/Tests/aweXpect.Reflection.Tests/ThatAssembly.HasDependenciesOnlyOn.Tests.cs b/Tests/aweXpect.Reflection.Tests/ThatAssembly.HasDependenciesOnlyOn.Tests.cs index a875017a..7fe64611 100644 --- a/Tests/aweXpect.Reflection.Tests/ThatAssembly.HasDependenciesOnlyOn.Tests.cs +++ b/Tests/aweXpect.Reflection.Tests/ThatAssembly.HasDependenciesOnlyOn.Tests.cs @@ -9,23 +9,11 @@ public sealed partial class ThatAssembly { public sealed class HasDependenciesOnlyOn { - /// - /// Excludes the framework facade assemblies that differ between target frameworks (e.g. netstandard on - /// net48), so that the tests only have to whitelist the actual non-framework dependencies. - /// - private static CustomizationLifetime ExcludeFrameworkAssemblies() - => Customize.aweXpect.Reflection().ExcludedAssemblyPrefixes - .Set([ - .. Customize.aweXpect.Reflection().ExcludedAssemblyPrefixes.Get(), "netstandard", "WindowsBase", - ]); - public sealed class Tests { [Fact] public async Task WhenAllowedMatchesAsWildcard_ShouldSucceed() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Assembly subject = typeof(In).Assembly; async Task Act() @@ -39,8 +27,6 @@ async Task Act() [Fact] public async Task WhenAllowedMatchesIgnoringCase_ShouldSucceed() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Assembly subject = typeof(In).Assembly; async Task Act() @@ -72,8 +58,6 @@ but it also had dependencies on [*] [Fact] public async Task WhenAssemblyDependsOnlyOnAllowed_ShouldSucceed() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Assembly subject = typeof(In).Assembly; async Task Act() @@ -121,8 +105,6 @@ async Task Act() [Fact] public async Task WhenAssemblyDependsOnlyOnAllowed_ShouldFail() { - using CustomizationLifetime _ = ExcludeFrameworkAssemblies(); - Assembly subject = typeof(In).Assembly; async Task Act()