Exemple #1
0
        public void Schema_FromMap()
        {
            var src  = new TestRow().Schema;
            var json = src.ToJSON();
            var trg  = Schema.FromJSON(JSONReader.DeserializeDataObject(json) as JSONDataMap, true);

            Assert.IsTrue(trg.Name.StartsWith("JSON"));
            Assert.IsTrue(trg.ReadOnly);
            Assert.AreEqual(trg.FieldDefs.Count(), src.FieldDefs.Count());

            Assert.AreEqual(trg["BoolField"].Type, typeof(Boolean?));
            Assert.AreEqual(trg["CharField"].Type, typeof(Char?));
            Assert.AreEqual(trg["DateTimeField"].Type, typeof(DateTime?));
            Assert.AreEqual(trg["GDIDField"].Type, typeof(string));

            Assert.AreEqual(trg["ByteField"].Type, typeof(Int32?));
            Assert.AreEqual(trg["SByteField"].Type, typeof(Int32?));
            Assert.AreEqual(trg["ShortField"].Type, typeof(Int32?));
            Assert.AreEqual(trg["Int16Field"].Type, typeof(Int32?));
            Assert.AreEqual(trg["UShortField"].Type, typeof(Int32?));
            Assert.AreEqual(trg["UInt16Field"].Type, typeof(Int32?));
            Assert.AreEqual(trg["IntField"].Type, typeof(Int32?));
            Assert.AreEqual(trg["Int32Field"].Type, typeof(Int32?));

            Assert.AreEqual(trg["UIntField"].Type, typeof(Int64?));
            Assert.AreEqual(trg["UInt32Field"].Type, typeof(Int64?));
            Assert.AreEqual(trg["LongField"].Type, typeof(Int64?));
            Assert.AreEqual(trg["Int64Field"].Type, typeof(Int64?));

            Assert.AreEqual(trg["ULongField"].Type, typeof(UInt64?));
            Assert.AreEqual(trg["UInt64Field"].Type, typeof(UInt64?));

            Assert.AreEqual(trg["FloatField"].Type, typeof(Double?));
            Assert.AreEqual(trg["SingleField"].Type, typeof(Double?));
            Assert.AreEqual(trg["DoubleField"].Type, typeof(Double?));

            Assert.AreEqual(trg["DecimalField"].Type, typeof(Decimal?));

            Assert.AreEqual(trg["FieldWithAttrs"].Attrs, src["FieldWithAttrs"].Attrs);
        }
Exemple #2
0
 public string RowDifferentFieldTypes(TestRow row)
 {
     return(row.ToJSON(JSONWritingOptions.CompactRowsAsMap));
 }
Exemple #3
0
 public string RowDifferentFieldTypes(TestRow row)
 {
   return row.ToJSON(JSONWritingOptions.CompactRowsAsMap);
 }
Exemple #4
0
 public string RowAndPrimitive_RowMiddle(int n, TestRow row, string s)
 {
     row.ID   = n;
     row.Name = s;
     return(row.ToJSON(JSONWritingOptions.CompactRowsAsMap));
 }
Exemple #5
0
 public string RowAndPrimitive_RowMiddle(int n, TestRow row, string s)
 {
   row.ID = n;
   row.Name = s;
   return row.ToJSON(JSONWritingOptions.CompactRowsAsMap);
 }