public async Task GenericTask_WithThrowingImplementation_ThrowsCommandFailedExceptionOnAwait() { var exception = new ExpectedTestException("Expected"); var instance = new TestThrowingImplementation(exception); var proxy = CreateForImplementation(instance); var task = proxy.InvokeGenericTask(); var e = await Assert.ThrowsAsync<CommandFailedException>(() => task); Assert.Equal(exception, e.InnerException); }
public void String_WithThrowingImplementation_ThrowsCommandFailedException() { var exception = new ExpectedTestException("Expected"); var instance = new TestThrowingImplementation(exception); var proxy = CreateForImplementation(instance); var ex = Assert.Throws <CommandFailedException>(() => { proxy.InvokeString(); }); Assert.Equal(exception, ex.InnerException); }
public void String_WithThrowingImplementation_ThrowsCommandFailedException() { var exception = new ExpectedTestException("Expected"); var instance = new TestThrowingImplementation(exception); var proxy = CreateForImplementation(instance); var ex = Assert.Throws<CommandFailedException>(() => { proxy.InvokeString(); }); Assert.Equal(exception, ex.InnerException); }
public async Task GenericTask_WithThrowingImplementation_ThrowsCommandFailedExceptionOnAwait() { var exception = new ExpectedTestException("Expected"); var instance = new TestThrowingImplementation(exception); var proxy = CreateForImplementation(instance); var task = proxy.InvokeGenericTask(); try { // Using Assert.Throws(async () => {}) doesn't work right here, // so falling back to the ol' try/catch. await task; } catch (CommandFailedException e) { Assert.Equal(exception, e.InnerException); return; } AssertX.FailExpectedException(); }