Esempio n. 1
0
        public void ReplacingMapElements()
        {
            SKEMAObject obj = new Dictionary <string, SKEMAObject>()
            {
                { "Replace", SKEMAObject.Any }
            };

            Assert.AreEqual(SKEMAType.MAP, obj.Type);
            Assert.AreEqual(SKEMAType.ANY, obj["Replace"].Type);

            obj["Replace"] = SKEMAObject.String;

            Assert.AreEqual(SKEMAType.STRING, obj["Replace"].Type);

            obj["Replace"] = SKEMAObject.ArrayOf(SKEMAObject.Boolean);

            Assert.AreEqual(SKEMAType.ARRAY, obj["Replace"].Type);

            Assert.AreEqual(SKEMAType.BOOLEAN, obj["Replace"].ArrayElementSKEMA.Type);

            obj["Replace"].ArrayElementSKEMA = SKEMAObject.ArrayOf(SKEMAObject.Float);

            Console.WriteLine(SKEMA.Write(obj));

            Assert.AreEqual(SKEMAType.ARRAY, obj["Replace"].ArrayElementSKEMA.Type);

            Assert.AreEqual(SKEMAType.FLOAT, obj["Replace"].ArrayElementSKEMA.ArrayElementSKEMA.Type);
        }
Esempio n. 2
0
        void skema_array(out SKEMAObject array)
        {
            SKEMAObject skemaObj;

            Expect(6);
            skema_value(out skemaObj);
            array = SKEMAObject.ArrayOf(skemaObj);
            Expect(7);
        }
Esempio n. 3
0
        public void ArraySKEMA()
        {
            SKEMAObject obj = SKEMAObject.ArrayOf(SKEMAObject.Float);

            Assert.IsFalse(obj.Valid(new int[] { 1, 2, 3 }));

            Assert.IsTrue(obj.Valid(new double[] { 1, 2, 3 }));

            obj = SKEMAObject.ArrayOf(SKEMAObject.Any);

            Assert.IsTrue(obj.Valid(new int[] { 1, 2, 3 }));

            Assert.IsTrue(obj.Valid(new double[] { 1, 2, 3 }));
        }