Open
Description
PAssert.Throws<TException>(Action a, ...)
has the expected try/catch structure, but PAssert.Throws<TException>(Func<Task> a, ...)
does not - the latter handles the case of the task faulting, but does not work if the code returning the task fails in any synchronous way, e.g:
public Task DoSomethingAsync() { throw new NotImplementedException(); }
---
[Test]
public void TestIt() {
PAssert.Throws<NotImplementedException>(() => obj.DoSomethingAsync());
}
This results in the NIE bubbling up out of the Throws call, as it doesn't check that the setup works, only that the resulting task does (or rather doesn't - i.e. that the Task faults).
Metadata
Metadata
Assignees
Labels
No labels