private static async Task SafeRpcSendAsync(IRemote remote) { TestPacket2 packet2 = new TestPacket2() { Value = new Random().Next() }; var res = await remote.SendAsyncSafeAwait <TestPacket2>(packet2); Assert.AreEqual(packet2.Value, res.Value); }
private static async Task RpcSendAsyncTypeError(IRemote remote) { TestPacket2 packet2 = new TestPacket2() { Value = new Random().Next() }; var(result, exception) = await remote.SendAsync <TestPacket1>(packet2); Assert.AreEqual(typeof(InvalidCastException), exception.GetType()); Assert.AreEqual(null, result); }
private static async Task RpcSendAsync(IRemote remote) { TestPacket2 packet2 = new TestPacket2() { Value = new Random().Next() }; var(result, exception) = await remote.SendAsync <TestPacket2>(packet2); Assert.AreEqual(null, exception); Assert.AreEqual(packet2.Value, result.Value); }
private static async Task SafeRpcSendAsyncTypeError(IRemote remote) { TestPacket2 packet2 = new TestPacket2() { Value = new Random().Next() }; TaskCompletionSource <Exception> source = new TaskCompletionSource <Exception>(); var data = remote.SendAsyncSafeAwait <TestPacket1>(packet2, ex => { source.SetResult(ex); }); var(result, complete) = await source.Task.WaitAsync(3000); Assert.AreEqual(true, complete); Assert.AreEqual(typeof(InvalidCastException), result.GetType()); }