diff --git a/TUnit.Assertions.Tests/SetAssertionTests.cs b/TUnit.Assertions.Tests/SetAssertionTests.cs index 06df508d00..d72a329458 100644 --- a/TUnit.Assertions.Tests/SetAssertionTests.cs +++ b/TUnit.Assertions.Tests/SetAssertionTests.cs @@ -1,3 +1,5 @@ +using System.Collections.Immutable; + namespace TUnit.Assertions.Tests; /// @@ -287,4 +289,11 @@ public async Task HashSet_String_Works() await Assert.That(set).IsProperSubsetOf(superset); } + + [Test] + public async Task Set_is_empty() + { + var set = ImmutableHashSet.Empty; + await Assert.That(set).IsEmpty(); + } } diff --git a/TUnit.Assertions/Extensions/Assert.cs b/TUnit.Assertions/Extensions/Assert.cs index d79d879444..a57788c496 100644 --- a/TUnit.Assertions/Extensions/Assert.cs +++ b/TUnit.Assertions/Extensions/Assert.cs @@ -19,7 +19,7 @@ public static class Assert /// This overload enables better type inference for dictionary operations like ContainsKey. /// Example: await Assert.That(dict).ContainsKey("key"); /// - [OverloadResolutionPriority(3)] + [OverloadResolutionPriority(2)] public static DictionaryAssertion That( IReadOnlyDictionary? value, [CallerArgumentExpression(nameof(value))] string? expression = null) @@ -33,7 +33,7 @@ public static DictionaryAssertion That( /// This overload enables better type inference for dictionary operations like ContainsKey. /// Example: await Assert.That(dict).ContainsKey("key"); /// - [OverloadResolutionPriority(2)] + [OverloadResolutionPriority(3)] public static MutableDictionaryAssertion That( IDictionary? value, [CallerArgumentExpression(nameof(value))] string? expression = null) @@ -136,7 +136,7 @@ public static AsyncEnumerableAssertion That( /// Example: await Assert.That(set).IsSubsetOf(otherSet); /// Example: await Assert.That(set).Overlaps(otherSet); /// - [OverloadResolutionPriority(2)] + [OverloadResolutionPriority(3)] public static SetAssertion That( ISet? value, [CallerArgumentExpression(nameof(value))] string? expression = null) diff --git a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt index a450c3eac2..88b0174ee3 100644 --- a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt @@ -192,7 +192,7 @@ namespace public static . That(.? value, [.("value")] string? expression = null) { } [.(2)] public static . That(.? value, [.("value")] string? expression = null) { } - [.(2)] + [.(3)] public static . That(.? value, [.("value")] string? expression = null) { } [.(1)] public static . That(<.?> func, [.("func")] string? expression = null) { } @@ -208,10 +208,10 @@ namespace [.(5)] public static . That(TItem[]? value, [.("value")] string? expression = null) { } public static . That(TValue? value, [.("value")] string? expression = null) { } - [.(2)] + [.(3)] public static . That(.? value, [.("value")] string? expression = null) where TKey : notnull { } - [.(3)] + [.(2)] public static . That(.? value, [.("value")] string? expression = null) where TKey : notnull { } public static Throws( exceptionType, action) { } diff --git a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt index 707d2c15c2..8ef216187e 100644 --- a/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt +++ b/TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt @@ -192,7 +192,7 @@ namespace public static . That(.? value, [.("value")] string? expression = null) { } [.(2)] public static . That(.? value, [.("value")] string? expression = null) { } - [.(2)] + [.(3)] public static . That(.? value, [.("value")] string? expression = null) { } [.(1)] public static . That(<.?> func, [.("func")] string? expression = null) { } @@ -208,10 +208,10 @@ namespace [.(5)] public static . That(TItem[]? value, [.("value")] string? expression = null) { } public static . That(TValue? value, [.("value")] string? expression = null) { } - [.(2)] + [.(3)] public static . That(.? value, [.("value")] string? expression = null) where TKey : notnull { } - [.(3)] + [.(2)] public static . That(.? value, [.("value")] string? expression = null) where TKey : notnull { } public static Throws( exceptionType, action) { }