public void testIndexedWithNull() { IndexedTestContainer testData = new IndexedTestContainer(); testData.strings = new string[] { null, "ddd", "ccc", null }; Object2Json o2J = new Object2Json(); o2J.NodeExpander = new FieldReflectionNodeExpander(); // make the format prettier o2J.IndentSize = 2; string json = o2J.toJson(testData); System.Console.WriteLine("json=" + json); string[] expressions = { "strings[0]", "strings[1]", "strings[2]", "strings[3]" }; object[] expectedValues = { testData.strings[0], testData.strings[1], testData.strings[2], testData.strings[3] }; validateJSON(json, expressions, expectedValues, "testIndexedWithNull"); }
public void testDemoIndexedPropertiesForUserguide() { IndexedTestContainer testData = new IndexedTestContainer(); testData.strings = new string[] { "eee", "ddd", "ccc", "bbb" }; testData.ints = new List <int>(new int[] { 6, 5, 4, 3, 2, 1 }); Object2Json o2J = new Object2Json(); o2J.NodeExpander = new FieldReflectionNodeExpander(); // make the format prettier o2J.IndentSize = 2; string json = o2J.toJson(testData); System.Console.WriteLine("json=" + json); string[] expressions = { "strings[3]", "strings[0]", "ints[0]", "ints[5]" }; object[] expectedValues = { testData.strings[3], testData.strings[0], testData.ints[0], testData.ints[5] }; validateJSON(json, expressions, expectedValues, "testDemoIndexedPropertiesForUserguide"); }
public void testDemoIndexedPropertiesForUserguide() { IndexedTestContainer testData = new IndexedTestContainer(); testData.strings = new string[] { "eee", "ddd", "ccc", "bbb" }; testData.ints = new List<int>(new int[] {6,5,4,3,2,1} ); Object2Json o2J = new Object2Json(); o2J.NodeExpander = new FieldReflectionNodeExpander(); // make the format prettier o2J.IndentSize = 2; string json = o2J.toJson(testData); System.Console.WriteLine("json=" + json); string[] expressions = { "strings[3]", "strings[0]", "ints[0]", "ints[5]"}; object[] expectedValues = {testData.strings[3], testData.strings[0], testData.ints[0], testData.ints[5] }; validateJSON(json, expressions, expectedValues, "testDemoIndexedPropertiesForUserguide"); }