Exemplo n.º 1
0
        public void TestArbitrary()
        {
            AutoResetEvent are = new AutoResetEvent(false);
            var client = new AustinHarris.JsonRpc.JsonRpcClient(remoteUri);
            var arbitrary = new Newtonsoft.Json.Linq.JObject();
            JObject r = null;
            Exception e = null;
            for (int i = 0; i < 10; i++)
            {
                arbitrary[getPrintableString(10)] = getPrintableString(20);
                arbitrary[getNonPrintableString(10)] = getNonPrintableString(20);
                arbitrary[getExtendedAsciiString(10)] = getExtendedAsciiString(20);
            }

            var myObs = client.Invoke<Newtonsoft.Json.Linq.JObject>("testArbitraryJObject", arbitrary, Scheduler.TaskPool);

            using(myObs.Subscribe(
                onNext: (jo) =>
                {
                   r = jo.Result;
                },
                onError:   _ =>
                {
                    e = _;
                },
                onCompleted: () => are.Set()
                ))
            {
                are.WaitOne();
            };

            
            Assert.IsTrue(r.ToString() == arbitrary.ToString());
            Assert.IsTrue(e == null);
        }
Exemplo n.º 2
0
        public void TestHelloWorld()
        {
            AutoResetEvent are = new AutoResetEvent(false);
            var client = new AustinHarris.JsonRpc.JsonRpcClient(remoteUri);
            var myObs = client.Invoke<string>("helloWorld", "My Message", Scheduler.TaskPool);

            using (myObs.Subscribe(
                onNext: _ =>
                {
                    Console.WriteLine(_.Result);
                    Assert.IsTrue(_.Result == "Hello World My Message");
                },
                onError: _ =>
                {
                    Assert.Fail();
                    are.Set();
                },
                onCompleted: () => are.Set()
                ))
            {
                are.WaitOne();
            }
        }
Exemplo n.º 3
0
        public void TestHelloWorld()
        {
            AutoResetEvent are    = new AutoResetEvent(false);
            var            client = new AustinHarris.JsonRpc.JsonRpcClient(remoteUri);
            var            myObs  = client.Invoke <string>("helloWorld", "My Message", Scheduler.TaskPool);

            using (myObs.Subscribe(
                       onNext: _ =>
            {
                Console.WriteLine(_.Result);
                Assert.IsTrue(_.Result == "Hello World My Message");
            },
                       onError: _ =>
            {
                Assert.Fail();
                are.Set();
            },
                       onCompleted: () => are.Set()
                       ))
            {
                are.WaitOne();
            }
        }
Exemplo n.º 4
0
        public void TestArbitrary()
        {
            AutoResetEvent are       = new AutoResetEvent(false);
            var            client    = new AustinHarris.JsonRpc.JsonRpcClient(remoteUri);
            var            arbitrary = new Newtonsoft.Json.Linq.JObject();
            JObject        r         = null;
            Exception      e         = null;

            for (int i = 0; i < 10; i++)
            {
                arbitrary[getPrintableString(10)]     = getPrintableString(20);
                arbitrary[getNonPrintableString(10)]  = getNonPrintableString(20);
                arbitrary[getExtendedAsciiString(10)] = getExtendedAsciiString(20);
            }

            var myObs = client.Invoke <Newtonsoft.Json.Linq.JObject>("testArbitraryJObject", arbitrary, Scheduler.TaskPool);

            using (myObs.Subscribe(
                       onNext: (jo) =>
            {
                r = jo.Result;
            },
                       onError:   _ =>
            {
                e = _;
            },
                       onCompleted: () => are.Set()
                       ))
            {
                are.WaitOne();
            };


            Assert.IsTrue(r.ToString() == arbitrary.ToString());
            Assert.IsTrue(e == null);
        }