-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Milestone
Description
Currently both Func<Task> and Func<Task<T>> are handled by AsyncFunctionAssertions which has a Subject of type Func<Task> and hence ignores the return value for Func<Task<T>>.
If we split AsyncFunctionAssertions into:
AsyncFunctionAssertionsforFunc<Task<T>>, andAsyncActionAssertionsforFunc<Task>
That should enable us to return the result of Task<T> for further assertions, similar to what was implement ed for Func<T> in #951, such as:
// Arrange/Act
Func<Task<int>> func = () => Task.FromResult(42);
// Assert
func.Should().NotThrow().Which.Should().Be(42);
(await func.Should().NotThrowAsync()).Which.Should().Be(42);This was inspired by this question
levmixali4