public async Task CatchAsync_Should_ReturnCorrectMessage_WhenAssertionIsFailed() { const string expectedMessage = "assertion_failed_message"; var result = await SafelyCatchAnNUnitExceptionAsync(() => Assert.CatchAsync(typeof(NullReferenceException), async() => { }, expectedMessage)); Assert.That(result.Message, Does.Contain(expectedMessage)); }
public async Task CatchAsync_Should_Succeed_WithBaseExceptionType() { await Assert.CatchAsync(typeof(Exception), async() => throw new ArgumentException()); }
public async Task CatchAsync_Should_ReturnCorrectExceptionWhenBaseExceptionTypeWasUsed() { await ThrowsAsyncShouldReturnCorrectExceptionBaseTest(exception => Assert.CatchAsync(typeof(Exception), async() => throw exception)); }
public async Task CatchAsync_Should_Should_ReturnCorrectException() { await ThrowsAsyncShouldReturnCorrectExceptionBaseTest(exception => Assert.CatchAsync(exception.GetType(), async() => throw exception)); }