public void testPerformance() { Jai j = new Jai(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); object output = null; int iterations = 100 * 1000; for (int i = 0; i < iterations; i++) { output = j.Deserialize <object>(JSON_LISTS); } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; string elapsedTime = String.Format("{0} iterations in {1:00}:{2:00}:{3:00}.{4:00}", iterations, ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); Console.WriteLine("testPerformance: " + elapsedTime); }
public void testUnsorted() { Jai j = new Jai(); IDictionary <string, object> dict = j.Deserialize <IDictionary <string, object> >(JSON_STRING); dict.Add("a", 2); string actual = j.Serialize(dict); //Console.WriteLine("actual: " + actual); string expected = "" + "{\n" + " \"string\":\"value\",\n" + " \"a\":2\n" + "}"; AssertEquals(expected, actual); }