예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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());
        }