Exemplo n.º 1
0
        public void mapJsonStringTest()
        {
            Dictionary <object, object> m = new Dictionary <object, object>();

            m.Add("testString", "didididi");
            m.Add("testInt", 100);
            m.Add("testInt2", "100");
            m.Add("testBoolean", "true");
            ParamTestModel model = new ParamTestModel();

            model.setAction("testAction");
            ParamTypeModel typeModel = new ParamTypeModel();

            typeModel.setAlarmStatus("status");
            typeModel.setInstanceClass(10);
            m.Add("testObject", typeModel);

            String d = QSStringUtil.getDictionaryToJson(m);

            Console.WriteLine(d);
            Object o = QSJSONUtil.convertJSONObject(d);

            Assert.IsNotNull(o);
            Dictionary <String, Object> dic = QSJSONUtil.JsonToDictionary(d);

            Assert.AreEqual(dic["testString"], "didididi");
            Assert.AreEqual(Convert.ToInt32(dic["testInt2"]), 100);
        }
Exemplo n.º 2
0
        public void put_bucket_external_mirror(String arg1)
        {
            // Write code here that turns the phrase above into concrete actions
            EvnContext evnContext = TestUtil.getEvnContext();

            Bucket = new Bucket(evnContext, bucketName);
            Bucket.PutBucketExternalMirrorInput input = new Bucket.PutBucketExternalMirrorInput();
            string obj = QSJSONUtil.convertJSONObject(arg1);

            input.setSourceSite(QSJSONUtil.toString(obj, "source_site"));
            putBucketExternalMirrorOutput = Bucket.putExternalMirror(input);
        }
Exemplo n.º 3
0
        public void testJson()
        {
            Dictionary <String, object> obj = new Dictionary <string, object>();

            obj.Add("testString", "test");
            obj.Add("testInt", 123);
            obj.Add("testList", "[{'test':'test'}]");
            String convertObj =
                QSJSONUtil.convertJSONObject(obj);
            Dictionary <String, Object> dic = QSJSONUtil.JsonToDictionary(convertObj);

            Assert.AreEqual(dic["testString"], "test");
            Assert.AreEqual(dic["testInt"], 123);
        }