public async Task TestException() { _serverMock.ThrowException <object>().Throws(new ArgumentException("Error received")); Func <Task> act = async() => { await _client.ThrowException <object>(); }; await act.Should().ThrowAsync <RpcException>() .WithMessage("SimpleRpc server exception: RemoteMethodInvocation"); }