-
-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Similar to the issues described in #4387 and #4418, the collection assertions don't work when the type given to Assert.That is ICollection or ICollection<T>.
This compiles:
IEnumerable<int> numbers = [1, 2, 3];
await Assert.That(numbers).IsEmpty();
This does not:
ICollection<int> numbers2 = [1, 2, 3];
await Assert.That(numbers2).IsEmpty();
The type that is returned when an ICollection is given to That() is ValueAssertion not CollectionAssertion.
Expected Behavior
Giving an ICollection or ICollection<T> to Assert.That will return CollectionAssertion<T>.
Actual Behavior
It returns ValueAssertion
Steps to Reproduce
[Test]
public async Task CollectionAssertionTest()
{
ICollection<int> nums = [1, 2, 3];
await Assert.That(nums).IsEmpty();
}TUnit Version
1.11.45
.NET Version
.NET10
Operating System
macOS
IDE / Test Runner
JetBrains Rider
Error Output / Stack Trace
Additional Context
No response
IDE-Specific Issue?
- I've confirmed this issue occurs when running via
dotnet testordotnet run, not just in my IDE
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working