Esempio n. 1
0
 public static RpcTestCase FromJson(JObject json)
 {
     return(new RpcTestCase
     {
         Name = json["Name"].AsString(),
         Request = RpcRequest.FromJson(json["Request"]),
         Response = RpcResponse.FromJson(json["Response"]),
     });
 }
Esempio n. 2
0
        public void TestFromJson()
        {
            var req = new RpcRequest()
            {
                Id      = 1,
                Jsonrpc = "myrpc",
                Method  = "get",
                Params  = new JObject[] {
                    new JBoolean(true)
                }
            };
            var json       = req.ToJson();
            var rpcRequest = RpcRequest.FromJson(json);

            rpcRequest.Jsonrpc.Should().Be("myrpc");
            rpcRequest.Method.Should().Be("get");
            rpcRequest.Id.Should().Be(1);
            rpcRequest.Params.Length.Should().Be(1);
        }