1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
|
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Globalization;
namespace System.Json
{
internal static class JsonValueVerifier
{
public static bool Compare(JsonValue objA, JsonValue objB)
{
if (objA == null && objB == null)
{
return true;
}
if ((objA == null && objB != null) || (objA != null && objB == null))
{
Log.Info("JsonValueVerifier Error: At least one of the JsonValue compared is null");
return false;
}
if (objA.JsonType != objB.JsonType)
{
Log.Info("JsonValueVerifier Error: These two JsonValues are not of the same Type!");
Log.Info("objA is of type {0} while objB is of type {1}", objA.JsonType.ToString(), objB.JsonType.ToString());
return false;
}
return CompareJsonValues(objA, objB);
}
public static bool CompareStringLists(List<string> strListA, List<string> strListB)
{
bool retValue = true;
if (strListA.Count != strListB.Count)
{
retValue = false;
}
else
{
for (int i = 0; i < strListA.Count; i++)
{
if (strListA[i] != strListB[i])
{
retValue = false;
break;
}
}
}
return retValue;
}
// Because we are currently taking a "flat design" model on JsonValues, the intellense doesn't work, and we have to be smart about what to verify
// and what not to so to avoid any potentially invalid access
private static bool CompareJsonValues(JsonValue objA, JsonValue objB)
{
bool retValue = false;
switch (objA.JsonType)
{
case JsonType.Array:
retValue = CompareJsonArrayTypes((JsonArray)objA, (JsonArray)objB);
break;
case JsonType.Object:
retValue = CompareJsonObjectTypes((JsonObject)objA, (JsonObject)objB);
break;
case JsonType.Boolean:
case JsonType.Number:
case JsonType.String:
retValue = CompareJsonPrimitiveTypes((JsonPrimitive)objA, (JsonPrimitive)objB);
break;
default:
Log.Info("JsonValueVerifier Error: the JsonValue isn’t an array, a complex type or a primitive type!");
break;
}
return retValue;
}
private static bool CompareJsonArrayTypes(JsonArray objA, JsonArray objB)
{
bool retValue = true;
if (objA == null || objB == null || objA.Count != objB.Count || objA.IsReadOnly != objB.IsReadOnly)
{
return false;
}
try
{
for (int i = 0; i < objA.Count; i++)
{
if (!Compare(objA[i], objB[i]))
{
Log.Info("JsonValueVerifier (JsonArrayType) Error: objA[{0}] = {1}", i, objA[i].ToString());
Log.Info("JsonValueVerifier (JsonArrayType) Error: objB[{0}] = {1}", i, objB[i].ToString());
return false;
}
}
}
catch (Exception e)
{
Log.Info("JsonValueVerifier (JsonArrayType) Error: An Exception was thrown: " + e);
return false;
}
return retValue;
}
private static bool CompareJsonObjectTypes(JsonObject objA, JsonObject objB)
{
bool retValue = true;
try
{
if (objA.Keys.Count != objB.Keys.Count)
{
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: objA.Keys.Count does not match objB.Keys.Count!");
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: objA.Keys.Count = {0}, objB.Keys.Count = {1}", objA.Keys.Count, objB.Keys.Count);
return false;
}
if (objA.Keys.IsReadOnly != objB.Keys.IsReadOnly)
{
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: objA.Keys.IsReadOnly does not match objB.Keys.IsReadOnly!");
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: objA.Keys.IsReadOnly = {0}, objB.Keys.IsReadOnly = {1}", objA.Keys.IsReadOnly, objB.Keys.IsReadOnly);
return false;
}
else
{
foreach (string keyA in objA.Keys)
{
if (!objB.ContainsKey(keyA))
{
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: objB does not contain Key " + keyA + "!");
return false;
}
if (!Compare(objA[keyA], objB[keyA]))
{
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: objA[" + keyA + "] = " + objA[keyA]);
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: objB[" + keyA + "] = " + objB[keyA]);
return false;
}
}
}
}
catch (Exception e)
{
Log.Info("JsonValueVerifier (JsonObjectTypes) Error: An Exception was thrown: " + e);
return false;
}
return retValue;
}
private static bool CompareJsonPrimitiveTypes(JsonPrimitive objA, JsonPrimitive objB)
{
try
{
if (objA.ToString() != objB.ToString())
{
// Special case due to daylight saving hours change: every March on the morning of the third Sunday, we adjust the time
// from 2am to 3am straight, so for that one hour 2:13am = 3:15am. We must result to the UTC ticks to verify the actual
// time is always the same, regardless of the loc/glob setup on the machine
if (objA.ToString().StartsWith("\"\\/Date(") && objA.ToString().EndsWith(")\\/\""))
{
return GetUTCTicks(objA) == GetUTCTicks(objB);
}
else
{
Log.Info("JsonValueVerifier (JsonPrimitiveTypes) Error: objA = " + objA.ToString());
Log.Info("JsonValueVerifier (JsonPrimitiveTypes) Error: objB = " + objB.ToString());
return false;
}
}
else
{
return true;
}
}
catch (Exception e)
{
Log.Info("JsonValueVerifier (JsonPrimitiveTypes) Error: An Exception was thrown: " + e);
return false;
}
}
// the input JsonPrimitive DateTime format is "\/Date(24735422733034-0700)\/" or "\/Date(24735422733034)\/"
// the only thing useful for us is the UTC ticks "24735422733034"
// everything after - if present - is just an optional offset between the local time and UTC
private static string GetUTCTicks(JsonPrimitive jprim)
{
string retValue = String.Empty;
string origStr = jprim.ToString();
int startIndex = origStr.IndexOf("Date(") + 5;
int endIndex = origStr.IndexOf('-', startIndex + 1); // the UTC ticks can start with a '-' sign (dates prior to 1970/01/01)
// if the optional offset is present in the data format, we want to take only the UTC ticks
if (startIndex < endIndex)
{
retValue = origStr.Substring(startIndex, endIndex - startIndex);
}
else
{
// otherwise we assume the time format is without the oiptional offset, or unexpected, and use the whole string for comparison.
retValue = origStr;
}
return retValue;
}
}
internal static class SpecialJsonValueHelper
{
public static JsonArray CreateDeepLevelJsonValuePair(int seed, out JsonArray newOrderJson)
{
Log.Info("Seed: {0}", seed);
Random rndGen = new Random(seed);
bool myBool = PrimitiveCreator.CreateInstanceOfBoolean(rndGen);
byte myByte = PrimitiveCreator.CreateInstanceOfByte(rndGen);
DateTime myDatetime = PrimitiveCreator.CreateInstanceOfDateTime(rndGen);
DateTimeOffset myDateTimeOffset = PrimitiveCreator.CreateInstanceOfDateTimeOffset(rndGen);
decimal myDecimal = PrimitiveCreator.CreateInstanceOfDecimal(rndGen);
double myDouble = PrimitiveCreator.CreateInstanceOfDouble(rndGen);
short myInt16 = PrimitiveCreator.CreateInstanceOfInt16(rndGen);
int myInt32 = PrimitiveCreator.CreateInstanceOfInt32(rndGen);
long myInt64 = PrimitiveCreator.CreateInstanceOfInt64(rndGen);
sbyte mySByte = PrimitiveCreator.CreateInstanceOfSByte(rndGen);
float mySingle = PrimitiveCreator.CreateInstanceOfSingle(rndGen);
string myString = PrimitiveCreator.CreateInstanceOfString(rndGen, 20, null);
ushort myUInt16 = PrimitiveCreator.CreateInstanceOfUInt16(rndGen);
uint myUInt32 = PrimitiveCreator.CreateInstanceOfUInt32(rndGen);
ulong myUInt64 = PrimitiveCreator.CreateInstanceOfUInt64(rndGen);
JsonArray myArray = new JsonArray { myBool, myByte, myDatetime, myDateTimeOffset, myDecimal, myDouble, myInt16, myInt32, myInt64, mySByte, mySingle, myString, myUInt16, myUInt32, myUInt64 };
JsonArray myArrayLevel2 = new JsonArray { myArray, myArray, myArray };
JsonArray myArrayLevel3 = new JsonArray { myArrayLevel2, myArrayLevel2, myArrayLevel2 };
JsonArray myArrayLevel4 = new JsonArray { myArrayLevel3, myArrayLevel3, myArrayLevel3 };
JsonArray myArrayLevel5 = new JsonArray { myArrayLevel4, myArrayLevel4, myArrayLevel4 };
JsonArray myArrayLevel6 = new JsonArray { myArrayLevel5, myArrayLevel5, myArrayLevel5 };
JsonArray myArrayLevel7 = new JsonArray { myArrayLevel6, myArrayLevel6, myArrayLevel6 };
JsonArray sourceJson = BuildJsonArrayinSequence1(myBool, myByte, myDatetime, myDateTimeOffset, myDecimal, myDouble, myInt16, myInt32, myInt64, mySByte, mySingle, myString, myUInt16, myUInt32, myUInt64, myArray, myArrayLevel2, myArrayLevel3, myArrayLevel4, myArrayLevel5, myArrayLevel6, myArrayLevel7);
newOrderJson = BuildJsonArrayinSequence2(myBool, myByte, myDatetime, myDateTimeOffset, myDecimal, myDouble, myInt16, myInt32, myInt64, mySByte, mySingle, myString, myUInt16, myUInt32, myUInt64, myArray, myArrayLevel2, myArrayLevel3, myArrayLevel4, myArrayLevel5, myArrayLevel6, myArrayLevel7);
return sourceJson;
}
public static JsonValue CreateDeepLevelJsonValue()
{
int seed = Environment.TickCount;
Log.Info("Seed: {0}", seed);
Random rndGen = new Random(seed);
bool myBool = PrimitiveCreator.CreateInstanceOfBoolean(rndGen);
byte myByte = PrimitiveCreator.CreateInstanceOfByte(rndGen);
DateTime myDatetime = PrimitiveCreator.CreateInstanceOfDateTime(rndGen);
DateTimeOffset myDateTimeOffset = PrimitiveCreator.CreateInstanceOfDateTimeOffset(rndGen);
decimal myDecimal = PrimitiveCreator.CreateInstanceOfDecimal(rndGen);
double myDouble = PrimitiveCreator.CreateInstanceOfDouble(rndGen);
short myInt16 = PrimitiveCreator.CreateInstanceOfInt16(rndGen);
int myInt32 = PrimitiveCreator.CreateInstanceOfInt32(rndGen);
long myInt64 = PrimitiveCreator.CreateInstanceOfInt64(rndGen);
sbyte mySByte = PrimitiveCreator.CreateInstanceOfSByte(rndGen);
float mySingle = PrimitiveCreator.CreateInstanceOfSingle(rndGen);
string myString = PrimitiveCreator.CreateInstanceOfString(rndGen, 20, null);
ushort myUInt16 = PrimitiveCreator.CreateInstanceOfUInt16(rndGen);
uint myUInt32 = PrimitiveCreator.CreateInstanceOfUInt32(rndGen);
ulong myUInt64 = PrimitiveCreator.CreateInstanceOfUInt64(rndGen);
JsonArray myArray = new JsonArray { myBool, myByte, myDatetime, myDateTimeOffset, myDecimal, myDouble, myInt16, myInt32, myInt64, mySByte, mySingle, myString, myUInt16, myUInt32, myUInt64 };
JsonArray myArrayLevel2 = new JsonArray { myArray, myArray, myArray };
JsonArray myArrayLevel3 = new JsonArray { myArrayLevel2, myArrayLevel2, myArrayLevel2 };
JsonArray myArrayLevel4 = new JsonArray { myArrayLevel3, myArrayLevel3, myArrayLevel3 };
JsonArray myArrayLevel5 = new JsonArray { myArrayLevel4, myArrayLevel4, myArrayLevel4 };
JsonArray myArrayLevel6 = new JsonArray { myArrayLevel5, myArrayLevel5, myArrayLevel5 };
JsonArray myArrayLevel7 = new JsonArray { myArrayLevel6, myArrayLevel6, myArrayLevel6 };
JsonArray sourceJson = BuildJsonArrayinSequence1(myBool, myByte, myDatetime, myDateTimeOffset, myDecimal, myDouble, myInt16, myInt32, myInt64, mySByte, mySingle, myString, myUInt16, myUInt32, myUInt64, myArray, myArrayLevel2, myArrayLevel3, myArrayLevel4, myArrayLevel5, myArrayLevel6, myArrayLevel7);
return sourceJson;
}
public static JsonObject CreateRandomPopulatedJsonObject(int seed, int length)
{
JsonObject myObject;
myObject = new JsonObject(
new Dictionary<string, JsonValue>()
{
{ "Name", "myArray" },
{ "Index", 1 }
});
for (int i = myObject.Count; i < length / 2; i++)
{
myObject.Add(PrimitiveCreator.CreateInstanceOfString(new Random(seed + i)), GetRandomJsonPrimitives(seed + (i * 2)));
}
for (int i = myObject.Count; i < length; i++)
{
myObject.Add(new KeyValuePair<string, JsonValue>(PrimitiveCreator.CreateInstanceOfString(new Random(seed + (i * 10))), GetRandomJsonPrimitives(seed + (i * 20))));
}
return myObject;
}
public static JsonArray CreatePrePopulatedJsonArray(int seed, int length)
{
JsonArray myObject;
myObject = new JsonArray(new List<JsonValue>());
for (int i = myObject.Count; i < length; i++)
{
myObject.Add(GetRandomJsonPrimitives(seed + i));
}
return myObject;
}
public static JsonObject CreateIndexPopulatedJsonObject(int seed, int length)
{
JsonObject myObject;
myObject = new JsonObject(new Dictionary<string, JsonValue>() { });
for (int i = myObject.Count; i < length; i++)
{
myObject.Add(i.ToString(CultureInfo.InvariantCulture), GetRandomJsonPrimitives(seed + i));
}
return myObject;
}
public static JsonValue[] CreatePrePopulatedJsonValueArray(int seed, int length)
{
JsonValue[] myObject = new JsonValue[length];
for (int i = 0; i < length; i++)
{
myObject[i] = GetRandomJsonPrimitives(seed + i);
}
return myObject;
}
public static KeyValuePair<string, JsonValue> CreatePrePopulatedKeyValuePair(int seed)
{
KeyValuePair<string, JsonValue> myObject = new KeyValuePair<string, JsonValue>(seed.ToString(), GetRandomJsonPrimitives(seed));
return myObject;
}
public static List<KeyValuePair<string, JsonValue>> CreatePrePopulatedListofKeyValuePair(int seed, int length)
{
List<KeyValuePair<string, JsonValue>> myObject = new List<KeyValuePair<string, JsonValue>>();
for (int i = 0; i < length; i++)
{
myObject.Add(CreatePrePopulatedKeyValuePair(seed + i));
}
return myObject;
}
public static JsonPrimitive GetRandomJsonPrimitives(int seed)
{
JsonPrimitive myObject;
Random rndGen = new Random(seed);
int mod = seed % 13;
switch (mod)
{
case 1:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfBoolean(rndGen));
break;
case 2:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfByte(rndGen));
break;
case 3:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfDateTime(rndGen));
break;
case 4:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfDecimal(rndGen));
break;
case 5:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfInt16(rndGen));
break;
case 6:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfInt32(rndGen));
break;
case 7:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfInt64(rndGen));
break;
case 8:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfSByte(rndGen));
break;
case 9:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfSingle(rndGen));
break;
case 10:
string temp;
do
{
temp = PrimitiveCreator.CreateInstanceOfString(rndGen);
}
while (temp == null);
myObject = new JsonPrimitive(temp);
break;
case 11:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfUInt16(rndGen));
break;
case 12:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfUInt32(rndGen));
break;
default:
myObject = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfUInt64(rndGen));
break;
}
return myObject;
}
public static string GetUniqueNonNullInstanceOfString(int seed, JsonObject sourceJson)
{
string retValue = String.Empty;
Random rndGen = new Random(seed);
do
{
retValue = PrimitiveCreator.CreateInstanceOfString(rndGen);
}
while (retValue == null || sourceJson.Keys.Contains(retValue));
return retValue;
}
public static JsonPrimitive GetUniqueValue(int seed, JsonObject sourceJson)
{
JsonPrimitive newValue;
int i = 0;
do
{
newValue = SpecialJsonValueHelper.GetRandomJsonPrimitives(seed + i);
i++;
}
while (sourceJson.ToString().IndexOf(newValue.ToString()) > 0);
return newValue;
}
private static JsonArray BuildJsonArrayinSequence2(bool myBool, byte myByte, DateTime myDatetime, DateTimeOffset myDateTimeOffset, decimal myDecimal, double myDouble, short myInt16, int myInt32, long myInt64, sbyte mySByte, float mySingle, string myString, ushort myUInt16, uint myUInt32, ulong myUInt64, JsonArray myArray, JsonArray myArrayLevel2, JsonArray myArrayLevel3, JsonArray myArrayLevel4, JsonArray myArrayLevel5, JsonArray myArrayLevel6, JsonArray myArrayLevel7)
{
JsonArray newOrderJson;
newOrderJson = new JsonArray
{
new JsonObject { { "Name", "myArray" }, { "Index", 1 }, { "Obj", myArray } },
new JsonObject { { "Name", "myArrayLevel2" }, { "Index", 2 }, { "Obj", myArrayLevel2 } },
new JsonObject { { "Name", "myArrayLevel2" }, { "Index", 2 }, { "Obj", myArrayLevel2 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myArrayLevel3" }, { "Index", 3 }, { "Obj", myArrayLevel3 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel3" }, { "Index", 3 }, { "Obj", myArrayLevel3 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myBool" }, { "Index", 8 }, { "Obj", myBool } },
new JsonObject { { "Name", "myByte" }, { "Index", 9 }, { "Obj", myByte } },
null,
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myByte" }, { "Index", 9 }, { "Obj", myByte } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myDatetime" }, { "Index", 10 }, { "Obj", myDatetime } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myDatetime" }, { "Index", 10 }, { "Obj", myDatetime } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myUInt16" }, { "Index", 20 }, { "Obj", myUInt16 } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myInt32" }, { "Index", 15 }, { "Obj", myInt32 } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myDouble" }, { "Index", 13 }, { "Obj", myDouble } },
new JsonObject { { "Name", "myInt16" }, { "Index", 14 }, { "Obj", myInt16 } },
new JsonObject { { "Name", "myString" }, { "Index", 19 }, { "Obj", myString } },
new JsonObject { { "Name", "myUInt16" }, { "Index", 20 }, { "Obj", myUInt16 } },
new JsonObject { { "Name", "myUInt16" }, { "Index", 20 }, { "Obj", myUInt16 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myInt16" }, { "Index", 14 }, { "Obj", myInt16 } },
new JsonObject { { "Name", "myInt32" }, { "Index", 15 }, { "Obj", myInt32 } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myDatetime" }, { "Index", 10 }, { "Obj", myDatetime } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "myInt32" }, { "Index", 15 }, { "Obj", myInt32 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myArrayLevel3" }, { "Index", 3 }, { "Obj", myArrayLevel3 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "mySingle" }, { "Index", 18 }, { "Obj", mySingle } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myString" }, { "Index", 19 }, { "Obj", myString } },
new JsonObject { { "Name", "myUInt64" }, { "Index", 22 }, { "Obj", myUInt64 } }
};
return newOrderJson;
}
private static JsonArray BuildJsonArrayinSequence1(bool myBool, byte myByte, DateTime myDatetime, DateTimeOffset myDateTimeOffset, decimal myDecimal, double myDouble, short myInt16, int myInt32, long myInt64, sbyte mySByte, float mySingle, string myString, ushort myUInt16, uint myUInt32, ulong myUInt64, JsonArray myArray, JsonArray myArrayLevel2, JsonArray myArrayLevel3, JsonArray myArrayLevel4, JsonArray myArrayLevel5, JsonArray myArrayLevel6, JsonArray myArrayLevel7)
{
JsonArray sourceJson = new JsonArray
{
new JsonObject { { "Name", "myArray" }, { "Index", 1 }, { "Obj", myArray } },
new JsonObject { { "Name", "myArrayLevel2" }, { "Index", 2 }, { "Obj", myArrayLevel2 } },
new JsonObject { { "Name", "myArrayLevel2" }, { "Index", 2 }, { "Obj", myArrayLevel2 } },
new JsonObject { { "Name", "myArrayLevel3" }, { "Index", 3 }, { "Obj", myArrayLevel3 } },
new JsonObject { { "Name", "myArrayLevel3" }, { "Index", 3 }, { "Obj", myArrayLevel3 } },
new JsonObject { { "Name", "myArrayLevel3" }, { "Index", 3 }, { "Obj", myArrayLevel3 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel4" }, { "Index", 4 }, { "Obj", myArrayLevel4 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel5" }, { "Index", 5 }, { "Obj", myArrayLevel5 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel6" }, { "Index", 6 }, { "Obj", myArrayLevel6 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myArrayLevel7" }, { "Index", 7 }, { "Obj", myArrayLevel7 } },
new JsonObject { { "Name", "myBool" }, { "Index", 8 }, { "Obj", myBool } },
new JsonObject { { "Name", "myByte" }, { "Index", 9 }, { "Obj", myByte } },
null,
new JsonObject { { "Name", "myByte" }, { "Index", 9 }, { "Obj", myByte } },
new JsonObject { { "Name", "myDatetime" }, { "Index", 10 }, { "Obj", myDatetime } },
new JsonObject { { "Name", "myDatetime" }, { "Index", 10 }, { "Obj", myDatetime } },
new JsonObject { { "Name", "myDatetime" }, { "Index", 10 }, { "Obj", myDatetime } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myDateTimeOffset" }, { "Index", 11 }, { "Obj", myDateTimeOffset } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myDecimal" }, { "Index", 12 }, { "Obj", myDecimal } },
new JsonObject { { "Name", "myDouble" }, { "Index", 13 }, { "Obj", myDouble } },
new JsonObject { { "Name", "myInt16" }, { "Index", 14 }, { "Obj", myInt16 } },
new JsonObject { { "Name", "myInt16" }, { "Index", 14 }, { "Obj", myInt16 } },
new JsonObject { { "Name", "myInt32" }, { "Index", 15 }, { "Obj", myInt32 } },
new JsonObject { { "Name", "myInt32" }, { "Index", 15 }, { "Obj", myInt32 } },
new JsonObject { { "Name", "myInt32" }, { "Index", 15 }, { "Obj", myInt32 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "myInt64" }, { "Index", 16 }, { "Obj", myInt64 } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "mySByte" }, { "Index", 17 }, { "Obj", mySByte } },
new JsonObject { { "Name", "mySingle" }, { "Index", 18 }, { "Obj", mySingle } },
new JsonObject { { "Name", "myString" }, { "Index", 19 }, { "Obj", myString } },
new JsonObject { { "Name", "myString" }, { "Index", 19 }, { "Obj", myString } },
new JsonObject { { "Name", "myUInt16" }, { "Index", 20 }, { "Obj", myUInt16 } },
new JsonObject { { "Name", "myUInt16" }, { "Index", 20 }, { "Obj", myUInt16 } },
new JsonObject { { "Name", "myUInt16" }, { "Index", 20 }, { "Obj", myUInt16 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myUInt32" }, { "Index", 21 }, { "Obj", myUInt32 } },
new JsonObject { { "Name", "myUInt64" }, { "Index", 22 }, { "Obj", myUInt64 } }
};
return sourceJson;
}
}
}
|