Esempio n. 1
0
        public void SerializeResponseT010()
        {
            var jsont = EmbeddedResourceManager.GetString("Assets.v1_spec_01.0_res.json");
            var jrs   = new JsonRpcSerializer(compatibilityLevel: JsonRpcCompatibilityLevel.Level1);
            var jrm   = new JsonRpcResponse(1L, "Hello JSON-RPC");
            var jsonr = jrs.SerializeResponse(jrm);

            JsonRpcSerializerTests.CompareJsonStrings(jsont, jsonr);
        }
Esempio n. 2
0
        public void SerializeRequestT020()
        {
            var jsont = EmbeddedResourceManager.GetString("Assets.v1_spec_02.0_req.json");
            var jrs   = new JsonRpcSerializer(compatibilityLevel: JsonRpcCompatibilityLevel.Level1);
            var jrm   = new JsonRpcRequest(99L, "postMessage", new object[] { "Hello all!" });
            var jsonr = jrs.SerializeRequest(jrm);

            JsonRpcSerializerTests.CompareJsonStrings(jsont, jsonr);
        }
        public void SerializeRequestT010()
        {
            var jsont = EmbeddedResourceManager.GetString("Assets.v2_spec_01.0_req.json");
            var jrs   = new JsonRpcSerializer();
            var jrm   = new JsonRpcRequest(1L, "subtract", new object[] { 42L, 23L });
            var jsonr = jrs.SerializeRequest(jrm);

            JsonRpcSerializerTests.CompareJsonStrings(jsont, jsonr);
        }
        public void SerializeResponseT010()
        {
            var jsont = EmbeddedResourceManager.GetString("Assets.v2_spec_01.0_res.json");
            var jrs   = new JsonRpcSerializer();
            var jrm   = new JsonRpcResponse(1L, 19L);
            var jsonr = jrs.SerializeResponse(jrm);

            JsonRpcSerializerTests.CompareJsonStrings(jsont, jsonr);
        }
        public void SerializeRequestT021()
        {
            var jsont = EmbeddedResourceManager.GetString("Assets.v2_spec_02.1_req.json");
            var jrs   = new JsonRpcSerializer();

            var jrmp = new Dictionary <string, object>
            {
                ["subtrahend"] = 23L,
                ["minuend"]    = 42L
            };

            var jrm   = new JsonRpcRequest(4L, "subtract", jrmp);
            var jsonr = jrs.SerializeRequest(jrm);

            JsonRpcSerializerTests.CompareJsonStrings(jsont, jsonr);
        }