Problem Statement
Currently, there’s no way to convert ShouldAssertion<T> to a Task, so it can’t be used with Task.WhenAll.
#3969 (comment)
[Test]
public async Task SpanTest()
{
Span<int> span = [1, 2, 3];
var list = new List<Task>();
using (Assert.Multiple())
{
list.Add(Assert.That(span.Length).IsNotEqualTo(3).AssertAsync());
list.Add(Assert.That(span[^1]).IsNotEqualTo(3).AssertAsync());
list.Add(span[^1].Should().BeNotEqualTo(3).AssertAsync()); // There’s no way to make a `Task`.
}
await Task.WhenAll(list);
}
Proposed Solution
public class ShouldAssertion<T>: IAssertion
{
Task IAssertion.AssertAsync() => _inner.AssertAsync();
}
Alternatives Considered
No response
Feature Category
Assertions
How important is this feature to you?
Important - significantly impacts my workflow
Additional Context
No response
Contribution
Problem Statement
Currently, there’s no way to convert
ShouldAssertion<T>to aTask, so it can’t be used withTask.WhenAll.#3969 (comment)
Proposed Solution
Alternatives Considered
No response
Feature Category
Assertions
How important is this feature to you?
Important - significantly impacts my workflow
Additional Context
No response
Contribution