コード例 #1
0
        public void OperationContractWithoutName()
        {
            var sp = new RpcServiceInvoker(new DotNetValueConverter(), new SimpleServiceLocator());
            sp.Map<ServiceWithoutName>();

            var result = sp.Invoke(new Request
                {
                    Id = 10,
                    JsonRpc = "2.0",
                    Method = "None"
                });

            Assert.IsType<Response>(result);
            var r = (Response) result;
            Assert.Equal(r.Result, "1");
        }
コード例 #2
0
        public void OperationContractWithoutName()
        {
            RpcServiceInvoker sp = new RpcServiceInvoker(new DotNetValueConverter(), new SimpleServiceLocator());
            sp.Map<ServiceWithoutName>();

            var result = sp.Invoke(new Request
            {
                Id = 10,
                JsonRpc = "2.0",
                Method = "None"
            });

            Assert.IsType<Response>(result);
            Response r = (Response)result;
            Assert.Equal(r.Result, "1");
        }
コード例 #3
0
        public void InvokeMethodWithArguments()
        {
            var sp = new RpcServiceInvoker(new DotNetValueConverter(), new SimpleServiceLocator());
            sp.Map<MyService>();

            var result = sp.Invoke(new Request
                {
                    Id = 10,
                    JsonRpc = "2.0",
                    Method = "Calculate",
                    Parameters = new object[] {"2", "3"}
                });

            Assert.IsType<Response>(result);
            var r = (Response) result;
            Assert.Equal(r.Result, "6");
        }