示例#1
0
        public void GivenParamsThenSenderSendCalled()
        {
            TestParams testParams = new TestParams()
            {
                ParamsName = "test name"
            };

            _client.Send <Result>(testParams);

            Mock.Get(_sender).Verify(s => s.SendLine("{\"method\":\"test.method\",\"params\":{\"ParamsName\":\"test name\"},\"id\":0,\"jsonrpc\":\"2.0\"}"), Times.Once);
        }
示例#2
0
        private static void Main()
        {
            var client = new JsonRpcClient("http://*****:*****@example.com",
                PhoneNumber = "555-1212",
            });

            System.Console.WriteLine(id);
            System.Console.ReadKey();
        }
示例#3
0
        private static void Main()
        {
            var client = new JsonRpcClient("http://*****:*****@example.com",
                PhoneNumber = "555-1212",
            });

            System.Console.WriteLine(id);
            System.Console.ReadKey();
        }
        public IEnumerator Send <TRequest, TResponse>(TRequest request, bool immediately = false)
            where TRequest : JsonRpcBaseRequest
            where TResponse : JsonRpcBaseResponse
        {
            if (immediately || !request.IsBulked)
            {
                yield return(CoroutineManager.StartCoroutine(JsonRpcClient.Send <TRequest, TResponse>(request))); // Send request immediately
            }
            else
            {
                if (!Authorized)
                {
                    throw new RDataException("You need to be authorized to send " + typeof(TRequest).Name);
                }

                _activeChunk.AddRequest(request);
            }
        }