Esempio n. 1
0
        public void ParseJSon_BraketSyntax()
        {
            dynamic config = new JSonConfiguration(JSon_TestString);

            DateTime expiry    = config["Expiry"];
            string   name      = config["Name"];
            double   price     = config["Price"];
            int      quantity  = config["Quantity"];
            int?     quantity2 = config["Quantity2"];
            string   size0     = config["Sizes"][0];

            Assert.AreEqual(new DateTime(2000, 01, 02), expiry);
            Assert.AreEqual("Apple", name);
            Assert.AreEqual(3.99, price);
            Assert.AreEqual(123, quantity);
            Assert.AreEqual(null, quantity2);
            Assert.AreEqual(size0, "Small");
        }
Esempio n. 2
0
        public void ParseJSon_PropertySyntax()
        {
            dynamic config = new JSonConfiguration(JSon_TestString);

            DateTime expiry    = config.Expiry;
            string   name      = config.Name;
            double   price     = config.Price;
            int      quantity  = config.Quantity;
            int?     quantity2 = config.Quantity2;
            string   size0     = config.Sizes[0];

            Assert.AreEqual(new DateTime(2000, 01, 02), expiry);
            Assert.AreEqual("Apple", name);
            Assert.AreEqual(3.99, price);
            Assert.AreEqual(123, quantity);
            Assert.AreEqual(null, quantity2);
            Assert.AreEqual(size0, "Small");
        }
        public void ParseJSon_BraketSyntax()
        {
            dynamic config  = new JSonConfiguration(JSon_TestString);

            DateTime expiry = config["Expiry"];
            string name     = config["Name"];
            double price    = config["Price"];
            int quantity    = config["Quantity"];
            int? quantity2  = config["Quantity2"];
            string size0    = config["Sizes"][0];

            Assert.AreEqual(new DateTime(2000,01,02), expiry);
            Assert.AreEqual("Apple"          , name);
            Assert.AreEqual(3.99             , price);
            Assert.AreEqual(123              , quantity);
            Assert.AreEqual(null             , quantity2);
            Assert.AreEqual(size0            , "Small");
        }
        public void ParseJSon_PropertySyntax()
        {
            dynamic config  = new JSonConfiguration(JSon_TestString);

            DateTime expiry = config.Expiry;
            string name     = config.Name;
            double price    = config.Price;
            int quantity    = config.Quantity;
            int? quantity2  = config.Quantity2;
            string size0    = config.Sizes[0];

            Assert.AreEqual(new DateTime(2000,01,02), expiry);
            Assert.AreEqual("Apple"          , name);
            Assert.AreEqual(3.99             , price);
            Assert.AreEqual(123              , quantity);
            Assert.AreEqual(null             , quantity2);
            Assert.AreEqual(size0            , "Small");
        }