-
-
Notifications
You must be signed in to change notification settings - Fork 108
Closed
Description
Problem
The code snippet to chain collection assertions from https://tunit.dev/docs/assertions/collections#chaining-collection-assertions does not compile (tested with latest TUnit v1.5.33):
[Test]
public async Task Chained_Collection_Assertions()
{
var numbers = new[] { 1, 2, 3, 4, 5 };
await Assert.That(numbers)
.IsNotEmpty()
.And.Count().IsEqualTo(5)
.And.Contains(3)
.And.DoesNotContain(10)
.And.IsInOrder()
.And.All(n => n > 0)
.And.Any(n => n == 5);
}with the error:
The type 'int' cannot be used as type parameter 'TCollection' in the generic type or method 'CollectionContainsAssertionExtensions.Contains<TCollection, TItem>(IAssertionSource, TItem, IEqualityComparer?, string?, string?)'. There is no boxing conversion from 'int' to 'System.Collections.Generic.IEnumerable'.
Investigation
Possible source of the problem: #3926 (released with v1.3.0).
Metadata
Metadata
Assignees
Labels
No labels