Ejemplo n.º 1
0
        public void deserializer_dynamic_should_properly_deserialize_simple_int_as_json()
        {
            string json = @"1";

            dynamic dynObj = JsonToDynamicDeserializer.Deserialize(json);

            Assert.AreEqual(
                1,
                dynObj);
        }
Ejemplo n.º 2
0
        public void deserializer_dynamic_should_properly_deserialize_inner_lists()
        {
            string json = @"[1,{a:1,b:2,c:[6,7,{a:'a',b:'2018-01-01'}]},3,null]";

            dynamic dynObj = JsonToDynamicDeserializer.Deserialize(json);

            Assert.AreEqual(
                typeof(List <object>),
                dynObj[1].c.GetType());
        }
Ejemplo n.º 3
0
        async public Task <S4JToken> ExecuteWithJsonParameters(String MethodDefinitionAsJson, params String[] ParametersAsJson)
        {
            Object[] parameters = null;

            if (ParametersAsJson != null)
            {
                parameters = ParametersAsJson.
                             Select(p => JsonToDynamicDeserializer.Deserialize(p)).
                             ToArray();
            }

            return(await ExecuteWithParameters(MethodDefinitionAsJson, parameters));
        }
Ejemplo n.º 4
0
        public void deserializer_dynamic_should_properly_deserialize_inner_lists_version2()
        {
            string json = @"{a:1,b:2,c:[6,7,{a:'a',b:'2018-01-01',c:[1,2,3,{a:1}]}]}";

            dynamic dynObj = JsonToDynamicDeserializer.Deserialize(json);

            Assert.AreEqual(
                typeof(List <object>),
                dynObj.c.GetType());

            Assert.AreEqual(
                typeof(List <object>),
                dynObj.c[2].c.GetType());
        }
Ejemplo n.º 5
0
        async public Task <S4JToken> ExecuteWithJsonParameters(String MethodDefinitionAsJson, Dictionary <string, string> ParametersAsJson)
        {
            Dictionary <string, object> parameters = null;

            if (ParametersAsJson != null)
            {
                parameters = ParametersAsJson.
                             ToDictionary(
                    p => p.Key,
                    p => JsonToDynamicDeserializer.Deserialize(p.Value));
            }

            return(await ExecuteWithParameters(MethodDefinitionAsJson, parameters));
        }