public void Schema_FromJSON(bool readOnly) { var src = new TeztRow().Schema; var json = src.ToJSON(); var trg = Schema.FromJSON(json, readOnly); Aver.AreEqual(trg.ReadOnly, readOnly); schemaAssertions(trg, src); }
void IRunnableHook.Prologue(Runner runner, FID id) { m_Row = new TeztRow { SimpleStr = "Doctor Aibolit", IntValue = 66, FloatValue = 19.66f, DateValue = new DateTime(1966, 12, 31, 19, 8, 59), NonUIValue = "nothing", Multiline = "Avva\r\nChichi", Nullable = null, Quotes = "\"Barm\"alei\"", Apostr = "Mc'Farlen", Comma = "1,2,3" }; }
public void Rowset_FromJSON(bool rowsAsMap) { var row = new TeztRow(); var src = new Rowset(row.Schema); row.BoolField = true; row.CharField = 'a'; row.StringField = "aaa"; row.DateTimeField = new DateTime(2016, 1, 2); row.GDIDField = new GDID(1, 2, 3); row.ByteField = 100; row.ShortField = -100; row.IntField = -999; row.UIntField = 254869; row.LongField = -267392; row.FloatField = 32768.32768F; row.DoubleField = -1048576.1048576D; row.DecimalField = 1.0529M; row.NullableField = null; row.ArrayInt = new int[] {-1, 0, 1}; row.ListString = new List<string> {"one", "two", "three"}; row.DictionaryIntStr = new Dictionary<int, string> { {1, "first"}, {2, "second"} }; row.RowField = new Person { Name = "John", Age = 20 }; src.Add(row); row.BoolField = false; row.CharField = 'b'; row.StringField = "bbb"; row.DateTimeField = new DateTime(2016, 2, 1); row.GDIDField = new GDID(4, 5, 6); row.ByteField = 101; row.ShortField = 100; row.IntField = 999; row.UIntField = 109876; row.LongField = 267392; row.FloatField = -32768.32768F; row.DoubleField = -048576.1048576D; row.DecimalField = -1.0529M; row.NullableField = null; row.ArrayInt = new int[] {1, 0, -1}; row.ListString = new List<string> { "three","two", "one" }; row.DictionaryIntStr = new Dictionary<int, string> { {0, "zero"}, {1, "first"}, {2, "second"} }; row.RowField = new Person { Name = "Ann", Age = 19 }; src.Add(row); var options = new NFX.Serialization.JSON.JSONWritingOptions { RowsetMetadata = true, SpaceSymbols = true, IndentWidth = 2, MemberLineBreak = true, ObjectLineBreak = true, RowsAsMap = rowsAsMap }; var json = src.ToJSON(options); var trg = RowsetBase.FromJSON(json); schemaAssertions(trg.Schema, src.Schema); rowsAssertions(src, trg, rowsAsMap); }
public void Schema_FromJSON(bool readOnly) { var src = new TeztRow().Schema; var json = src.ToJSON(); var trg = Schema.FromJSON(json, readOnly); Assert.AreEqual(trg.ReadOnly, readOnly); schemaAssertions(trg, src); }
public void Rowset_FromJSON(bool rowsAsMap) { var row = new TeztRow(); var src = new Rowset(row.Schema); row.BoolField = true; row.CharField = 'a'; row.StringField = "aaa"; row.DateTimeField = new DateTime(2016, 1, 2); row.GDIDField = new GDID(1, 2, 3); row.ByteField = 100; row.ShortField = -100; row.IntField = -999; row.UIntField = 254869; row.LongField = -267392; row.FloatField = 32768.32768F; row.DoubleField = -1048576.1048576D; row.DecimalField = 1.0529M; row.NullableField = null; row.ArrayInt = new int[] { -1, 0, 1 }; row.ListString = new List <string> { "one", "two", "three" }; row.DictionaryIntStr = new Dictionary <int, string> { { 1, "first" }, { 2, "second" } }; row.RowField = new Person { Name = "John", Age = 20 }; src.Add(row); row.BoolField = false; row.CharField = 'b'; row.StringField = "bbb"; row.DateTimeField = new DateTime(2016, 2, 1); row.GDIDField = new GDID(4, 5, 6); row.ByteField = 101; row.ShortField = 100; row.IntField = 999; row.UIntField = 109876; row.LongField = 267392; row.FloatField = -32768.32768F; row.DoubleField = -048576.1048576D; row.DecimalField = -1.0529M; row.NullableField = null; row.ArrayInt = new int[] { 1, 0, -1 }; row.ListString = new List <string> { "three", "two", "one" }; row.DictionaryIntStr = new Dictionary <int, string> { { 0, "zero" }, { 1, "first" }, { 2, "second" } }; row.RowField = new Person { Name = "Ann", Age = 19 }; src.Add(row); var options = new NFX.Serialization.JSON.JSONWritingOptions { RowsetMetadata = true, SpaceSymbols = true, IndentWidth = 2, MemberLineBreak = true, ObjectLineBreak = true, RowsAsMap = rowsAsMap }; var json = src.ToJSON(options); var trg = RowsetBase.FromJSON(json); schemaAssertions(trg.Schema, src.Schema); rowsAssertions(src, trg, rowsAsMap); }