Ejemplo n.º 1
0
        public void AllPropertiesOnObjectMustMatch()
        {
            var properties = new List<Screw.Framework.Kernel.Json.Value> ();
            var value1 = new Screw.Framework.Kernel.Json.Value ();
            var value2 = new Screw.Framework.Kernel.Json.Value ();
            var value3 = new Screw.Framework.Kernel.Json.Value ();

            properties.Add (value1);
            properties.Add (value2);
            properties.Add (value3);

            var array = new Screw.Framework.Kernel.Json.Array (properties);

            Assert.AreEqual (3, array.Elements.Count);
            Assert.AreSame (value1, array.Elements [0]);
            Assert.AreSame (value2, array.Elements [1]);
            Assert.AreSame (value3, array.Elements [2]);
        }
Ejemplo n.º 2
0
        public void AllPropertiesOnObjectMustMatch()
        {
            var properties = new Dictionary<string, Screw.Framework.Kernel.Json.Value> ();
            var value1 = new Screw.Framework.Kernel.Json.Value ();
            var value2 = new Screw.Framework.Kernel.Json.Value ();
            var value3 = new Screw.Framework.Kernel.Json.Value ();

            properties.Add ("a", value1);
            properties.Add ("b", value2);
            properties.Add ("c", value3);

            var @object = new Screw.Framework.Kernel.Json.Object (properties);

            Assert.AreEqual (3, @object.Properties.Count);
            Assert.IsTrue (@object.Properties.ContainsKey ("a"));
            Assert.IsTrue (@object.Properties.ContainsKey ("b"));
            Assert.IsTrue (@object.Properties.ContainsKey ("c"));
            Assert.AreSame (value1, @object.Properties ["a"]);
            Assert.AreSame (value2, @object.Properties ["b"]);
            Assert.AreSame (value3, @object.Properties ["c"]);
        }
Ejemplo n.º 3
0
        string Screw.Framework.Kernel.Json.IJson.Serialize(Screw.Framework.Kernel.Json.Value input)
        {
            if (!pass)
            {
                pass = true;
                return "";
            }

            var response = (Screw.Framework.Kernel.Json.Object)input;
            Assert.AreEqual ("request identifier", ((Screw.Framework.Kernel.Json.String)response.Properties ["id"]).Value);
            Assert.IsInstanceOf <Screw.Framework.Kernel.Json.Null> (response.Properties ["error"]);
            result = response.Properties ["result"];
            return  "output json string";
        }