Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions TUnit.Assertions.Tests/SetAssertionTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Collections.Immutable;

namespace TUnit.Assertions.Tests;

/// <summary>
Expand Down Expand Up @@ -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<int>.Empty;
await Assert.That(set).IsEmpty();
}
}
6 changes: 3 additions & 3 deletions TUnit.Assertions/Extensions/Assert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
/// </summary>
[OverloadResolutionPriority(3)]
[OverloadResolutionPriority(2)]
public static DictionaryAssertion<TKey, TValue> That<TKey, TValue>(
IReadOnlyDictionary<TKey, TValue>? value,
[CallerArgumentExpression(nameof(value))] string? expression = null)
Expand All @@ -33,7 +33,7 @@ public static DictionaryAssertion<TKey, TValue> That<TKey, TValue>(
/// This overload enables better type inference for dictionary operations like ContainsKey.
/// Example: await Assert.That(dict).ContainsKey("key");
/// </summary>
[OverloadResolutionPriority(2)]
[OverloadResolutionPriority(3)]
public static MutableDictionaryAssertion<TKey, TValue> That<TKey, TValue>(
IDictionary<TKey, TValue>? value,
[CallerArgumentExpression(nameof(value))] string? expression = null)
Expand Down Expand Up @@ -136,7 +136,7 @@ public static AsyncEnumerableAssertion<TItem> That<TItem>(
/// Example: await Assert.That(set).IsSubsetOf(otherSet);
/// Example: await Assert.That(set).Overlaps(otherSet);
/// </summary>
[OverloadResolutionPriority(2)]
[OverloadResolutionPriority(3)]
public static SetAssertion<TItem> That<TItem>(
ISet<TItem>? value,
[CallerArgumentExpression(nameof(value))] string? expression = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace
public static .<TItem> That<TItem>(.<TItem>? value, [.("value")] string? expression = null) { }
[.(2)]
public static .<TItem> That<TItem>(.<TItem>? value, [.("value")] string? expression = null) { }
[.(2)]
[.(3)]
public static .<TItem> That<TItem>(.<TItem>? value, [.("value")] string? expression = null) { }
[.(1)]
public static .<TItem> That<TItem>(<.<TItem>?> func, [.("func")] string? expression = null) { }
Expand All @@ -208,10 +208,10 @@ namespace
[.(5)]
public static .<TItem> That<TItem>(TItem[]? value, [.("value")] string? expression = null) { }
public static .<TValue> That<TValue>(TValue? value, [.("value")] string? expression = null) { }
[.(2)]
[.(3)]
public static .<TKey, TValue> That<TKey, TValue>(.<TKey, TValue>? value, [.("value")] string? expression = null)
where TKey : notnull { }
[.(3)]
[.(2)]
public static .<TKey, TValue> That<TKey, TValue>(.<TKey, TValue>? value, [.("value")] string? expression = null)
where TKey : notnull { }
public static Throws( exceptionType, action) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace
public static .<TItem> That<TItem>(.<TItem>? value, [.("value")] string? expression = null) { }
[.(2)]
public static .<TItem> That<TItem>(.<TItem>? value, [.("value")] string? expression = null) { }
[.(2)]
[.(3)]
public static .<TItem> That<TItem>(.<TItem>? value, [.("value")] string? expression = null) { }
[.(1)]
public static .<TItem> That<TItem>(<.<TItem>?> func, [.("func")] string? expression = null) { }
Expand All @@ -208,10 +208,10 @@ namespace
[.(5)]
public static .<TItem> That<TItem>(TItem[]? value, [.("value")] string? expression = null) { }
public static .<TValue> That<TValue>(TValue? value, [.("value")] string? expression = null) { }
[.(2)]
[.(3)]
public static .<TKey, TValue> That<TKey, TValue>(.<TKey, TValue>? value, [.("value")] string? expression = null)
where TKey : notnull { }
[.(3)]
[.(2)]
public static .<TKey, TValue> That<TKey, TValue>(.<TKey, TValue>? value, [.("value")] string? expression = null)
where TKey : notnull { }
public static Throws( exceptionType, action) { }
Expand Down
Loading