public async Task When_function_of_task_int_in_async_method_throws_not_excepted_exception_it_should_succeed() { // Arrange var asyncObject = new AsyncClass(); Func <Task <int> > f = () => asyncObject.ThrowTaskIntAsync <InvalidOperationException>(true); // Act / Assert await f.Should().NotThrowAsync <ArgumentNullException>(); }
public void When_function_of_task_int_in_async_method_throws_the_expected_exception_it_should_succeed() { // Arrange var asyncObject = new AsyncClass(); Func <Task <int> > f = () => asyncObject.ThrowTaskIntAsync <ArgumentNullException>(true); // Act / Assert f.Should().Throw <ArgumentNullException>(); }