PageRenderTime 64ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/test/System.Json.Test.Integration/JsonStringRoundTripTests.cs

https://bitbucket.org/mdavid/aspnetwebstack
C# | 583 lines | 450 code | 56 blank | 77 comment | 48 complexity | d924bb7bf55dce80acddbbca725ba2e9 MD5 | raw file
  1. using System.Collections.Generic;
  2. using System.Globalization;
  3. using System.IO;
  4. using Xunit;
  5. namespace System.Json
  6. {
  7. /// <summary>
  8. /// Tests for round-tripping <see cref="JsonValue"/> instances via JSON strings.
  9. /// </summary>
  10. public class JsonStringRoundTripTests
  11. {
  12. /// <summary>
  13. /// Tests for <see cref="JsonObject"/> round-trip.
  14. /// </summary>
  15. [Fact]
  16. public void ValidJsonObjectRoundTrip()
  17. {
  18. bool oldValue = CreatorSettings.CreateDateTimeWithSubMilliseconds;
  19. CreatorSettings.CreateDateTimeWithSubMilliseconds = false;
  20. try
  21. {
  22. int seed = 1;
  23. Log.Info("Seed: {0}", seed);
  24. Random rndGen = new Random(seed);
  25. JsonObject sourceJson = new JsonObject(new Dictionary<string, JsonValue>()
  26. {
  27. { "Name", PrimitiveCreator.CreateInstanceOfString(rndGen) },
  28. { "Age", PrimitiveCreator.CreateInstanceOfInt32(rndGen) },
  29. { "DateTimeOffset", PrimitiveCreator.CreateInstanceOfDateTimeOffset(rndGen) },
  30. { "Birthday", PrimitiveCreator.CreateInstanceOfDateTime(rndGen) }
  31. });
  32. sourceJson.Add("NewItem1", PrimitiveCreator.CreateInstanceOfString(rndGen));
  33. sourceJson.Add(new KeyValuePair<string, JsonValue>("NewItem2", PrimitiveCreator.CreateInstanceOfString(rndGen)));
  34. JsonObject newJson = (JsonObject)JsonValue.Parse(sourceJson.ToString());
  35. newJson.Remove("NewItem1");
  36. sourceJson.Remove("NewItem1");
  37. Assert.False(newJson.ContainsKey("NewItem1"));
  38. Assert.False(!JsonValueVerifier.Compare(sourceJson, newJson));
  39. }
  40. finally
  41. {
  42. CreatorSettings.CreateDateTimeWithSubMilliseconds = oldValue;
  43. }
  44. }
  45. /// <summary>
  46. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="DateTime"/>.
  47. /// </summary>
  48. [Fact]
  49. public void SimpleDateTimeTest()
  50. {
  51. JsonValue jv = DateTime.Now;
  52. JsonValue jv2 = JsonValue.Parse(jv.ToString());
  53. Assert.Equal(jv.ToString(), jv2.ToString());
  54. }
  55. /// <summary>
  56. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="DateTimeOffset"/>.
  57. /// </summary>
  58. [Fact]
  59. public void ValidJsonObjectDateTimeOffsetRoundTrip()
  60. {
  61. int seed = 1;
  62. Log.Info("Seed: {0}", seed);
  63. Random rndGen = new Random(seed);
  64. JsonPrimitive sourceJson = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfDateTimeOffset(rndGen));
  65. JsonPrimitive newJson = (JsonPrimitive)JsonValue.Parse(sourceJson.ToString());
  66. Assert.True(JsonValueVerifier.Compare(sourceJson, newJson));
  67. }
  68. /// <summary>
  69. /// Tests for <see cref="JsonArray"/> round-trip.
  70. /// </summary>
  71. [Fact]
  72. public void ValidJsonArrayRoundTrip()
  73. {
  74. bool oldValue = CreatorSettings.CreateDateTimeWithSubMilliseconds;
  75. CreatorSettings.CreateDateTimeWithSubMilliseconds = false;
  76. try
  77. {
  78. int seed = 1;
  79. Log.Info("Seed: {0}", seed);
  80. Random rndGen = new Random(seed);
  81. JsonArray sourceJson = new JsonArray(new JsonValue[]
  82. {
  83. PrimitiveCreator.CreateInstanceOfBoolean(rndGen),
  84. PrimitiveCreator.CreateInstanceOfByte(rndGen),
  85. PrimitiveCreator.CreateInstanceOfDateTime(rndGen),
  86. PrimitiveCreator.CreateInstanceOfDateTimeOffset(rndGen),
  87. PrimitiveCreator.CreateInstanceOfDecimal(rndGen),
  88. PrimitiveCreator.CreateInstanceOfDouble(rndGen),
  89. PrimitiveCreator.CreateInstanceOfInt16(rndGen),
  90. PrimitiveCreator.CreateInstanceOfInt32(rndGen),
  91. PrimitiveCreator.CreateInstanceOfInt64(rndGen),
  92. PrimitiveCreator.CreateInstanceOfSByte(rndGen),
  93. PrimitiveCreator.CreateInstanceOfSingle(rndGen),
  94. PrimitiveCreator.CreateInstanceOfString(rndGen),
  95. PrimitiveCreator.CreateInstanceOfUInt16(rndGen),
  96. PrimitiveCreator.CreateInstanceOfUInt32(rndGen),
  97. PrimitiveCreator.CreateInstanceOfUInt64(rndGen)
  98. });
  99. JsonArray newJson = (JsonArray)JsonValue.Parse(sourceJson.ToString());
  100. Log.Info("Original JsonArray object is: {0}", sourceJson);
  101. Log.Info("Round-tripped JsonArray object is: {0}", newJson);
  102. Assert.True(JsonValueVerifier.Compare(sourceJson, newJson));
  103. }
  104. finally
  105. {
  106. CreatorSettings.CreateDateTimeWithSubMilliseconds = oldValue;
  107. }
  108. }
  109. /// <summary>
  110. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="String"/>.
  111. /// </summary>
  112. [Fact]
  113. public void ValidPrimitiveStringRoundTrip()
  114. {
  115. Assert.True(this.TestPrimitiveType("String"));
  116. }
  117. /// <summary>
  118. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="DateTime"/>.
  119. /// </summary>
  120. [Fact]
  121. public void ValidPrimitiveDateTimeRoundTrip()
  122. {
  123. bool oldValue = CreatorSettings.CreateDateTimeWithSubMilliseconds;
  124. CreatorSettings.CreateDateTimeWithSubMilliseconds = false;
  125. try
  126. {
  127. Assert.True(this.TestPrimitiveType("DateTime"));
  128. }
  129. finally
  130. {
  131. CreatorSettings.CreateDateTimeWithSubMilliseconds = oldValue;
  132. }
  133. }
  134. /// <summary>
  135. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Boolean"/>.
  136. /// </summary>
  137. [Fact]
  138. public void ValidPrimitiveBooleanRoundTrip()
  139. {
  140. Assert.True(this.TestPrimitiveType("Boolean"));
  141. }
  142. /// <summary>
  143. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Byte"/>.
  144. /// </summary>
  145. [Fact]
  146. public void ValidPrimitiveByteRoundTrip()
  147. {
  148. Assert.True(this.TestPrimitiveType("Byte"));
  149. }
  150. /// <summary>
  151. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Decimal"/>.
  152. /// </summary>
  153. [Fact]
  154. public void ValidPrimitiveDecimalRoundTrip()
  155. {
  156. Assert.True(this.TestPrimitiveType("Decimal"));
  157. }
  158. /// <summary>
  159. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Double"/>.
  160. /// </summary>
  161. [Fact]
  162. public void ValidPrimitiveDoubleRoundTrip()
  163. {
  164. Assert.True(this.TestPrimitiveType("Double"));
  165. }
  166. /// <summary>
  167. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Int16"/>.
  168. /// </summary>
  169. [Fact]
  170. public void ValidPrimitiveInt16RoundTrip()
  171. {
  172. Assert.True(this.TestPrimitiveType("Int16"));
  173. }
  174. /// <summary>
  175. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Int32"/>.
  176. /// </summary>
  177. [Fact]
  178. public void ValidPrimitiveInt32RoundTrip()
  179. {
  180. Assert.True(this.TestPrimitiveType("Int32"));
  181. }
  182. /// <summary>
  183. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Int64"/>.
  184. /// </summary>
  185. [Fact]
  186. public void ValidPrimitiveInt64RoundTrip()
  187. {
  188. Assert.True(this.TestPrimitiveType("Int64"));
  189. }
  190. /// <summary>
  191. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="SByte"/>.
  192. /// </summary>
  193. [Fact]
  194. public void ValidPrimitiveSByteRoundTrip()
  195. {
  196. Assert.True(this.TestPrimitiveType("SByte"));
  197. }
  198. /// <summary>
  199. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="UInt16"/>.
  200. /// </summary>
  201. [Fact]
  202. public void ValidPrimitiveUInt16RoundTrip()
  203. {
  204. Assert.True(this.TestPrimitiveType("Uint16"));
  205. }
  206. /// <summary>
  207. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="UInt32"/>.
  208. /// </summary>
  209. [Fact]
  210. public void ValidPrimitiveUInt32RoundTrip()
  211. {
  212. Assert.True(this.TestPrimitiveType("UInt32"));
  213. }
  214. /// <summary>
  215. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="UInt64"/>.
  216. /// </summary>
  217. [Fact]
  218. public void ValidPrimitiveUInt64RoundTrip()
  219. {
  220. Assert.True(this.TestPrimitiveType("UInt64"));
  221. }
  222. /// <summary>
  223. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Char"/>.
  224. /// </summary>
  225. [Fact]
  226. public void ValidPrimitiveCharRoundTrip()
  227. {
  228. Assert.True(this.TestPrimitiveType("Char"));
  229. }
  230. /// <summary>
  231. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Guid"/>.
  232. /// </summary>
  233. [Fact]
  234. public void ValidPrimitiveGuidRoundTrip()
  235. {
  236. Assert.True(this.TestPrimitiveType("Guid"));
  237. }
  238. /// <summary>
  239. /// Test for <see cref="JsonPrimitive"/> round-trip created via <see cref="Uri"/>.
  240. /// </summary>
  241. [Fact]
  242. public void ValidPrimitiveUriRoundTrip()
  243. {
  244. Assert.True(this.TestPrimitiveType("Uri"));
  245. }
  246. /// <summary>
  247. /// Tests for <see cref="JsonValue"/> round-trip created via <code>null</code> values.
  248. /// </summary>
  249. [Fact]
  250. public void ValidPrimitiveNullRoundTrip()
  251. {
  252. Assert.True(this.TestPrimitiveType("Null"));
  253. }
  254. /// <summary>
  255. /// Tests for round-tripping <see cref="JsonPrimitive"/> objects via casting to CLR instances.
  256. /// </summary>
  257. [Fact]
  258. public void JsonValueRoundTripCastTests()
  259. {
  260. int seed = 1;
  261. Log.Info("Seed: {0}", seed);
  262. Random rndGen = new Random(seed);
  263. this.DoRoundTripCasting(String.Empty, typeof(string));
  264. this.DoRoundTripCasting("null", typeof(string));
  265. string str;
  266. do
  267. {
  268. str = PrimitiveCreator.CreateInstanceOfString(rndGen);
  269. } while (str == null);
  270. this.DoRoundTripCasting(str, typeof(string));
  271. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfInt16(rndGen), typeof(int));
  272. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfInt32(rndGen), typeof(int));
  273. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfInt64(rndGen), typeof(int));
  274. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfUInt16(rndGen), typeof(int));
  275. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfUInt32(rndGen), typeof(int));
  276. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfUInt64(rndGen), typeof(int));
  277. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfGuid(rndGen), typeof(Guid));
  278. this.DoRoundTripCasting(new Uri("http://bug/test?param=hello%0a"), typeof(Uri));
  279. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfChar(rndGen), typeof(char));
  280. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfBoolean(rndGen), typeof(bool));
  281. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfDateTime(rndGen), typeof(DateTime));
  282. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfDateTimeOffset(rndGen), typeof(DateTimeOffset));
  283. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfDouble(rndGen), typeof(double));
  284. this.DoRoundTripCasting(PrimitiveCreator.CreateInstanceOfDouble(rndGen), typeof(float));
  285. this.DoRoundTripCasting(0.12345f, typeof(double));
  286. this.DoRoundTripCasting(0.12345f, typeof(float));
  287. }
  288. private bool TestPrimitiveType(string typeName)
  289. {
  290. bool retValue = true;
  291. bool specialCase = false;
  292. int seed = 1;
  293. Log.Info("Seed: {0}", seed);
  294. Random rndGen = new Random(seed);
  295. JsonPrimitive sourceJson = null;
  296. JsonPrimitive sourceJson2;
  297. object tempValue = null;
  298. switch (typeName.ToLower())
  299. {
  300. case "boolean":
  301. tempValue = PrimitiveCreator.CreateInstanceOfBoolean(rndGen);
  302. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString().ToLower());
  303. sourceJson2 = new JsonPrimitive((bool)tempValue);
  304. break;
  305. case "byte":
  306. tempValue = PrimitiveCreator.CreateInstanceOfByte(rndGen);
  307. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  308. sourceJson2 = new JsonPrimitive((byte)tempValue);
  309. break;
  310. case "char":
  311. sourceJson2 = new JsonPrimitive((char)PrimitiveCreator.CreateInstanceOfChar(rndGen));
  312. specialCase = true;
  313. break;
  314. case "datetime":
  315. tempValue = PrimitiveCreator.CreateInstanceOfDateTime(rndGen);
  316. sourceJson2 = new JsonPrimitive((DateTime)tempValue);
  317. sourceJson = (JsonPrimitive)JsonValue.Parse(sourceJson2.ToString());
  318. break;
  319. case "decimal":
  320. tempValue = PrimitiveCreator.CreateInstanceOfDecimal(rndGen);
  321. sourceJson = (JsonPrimitive)JsonValue.Parse(((decimal)tempValue).ToString(NumberFormatInfo.InvariantInfo));
  322. sourceJson2 = new JsonPrimitive((decimal)tempValue);
  323. break;
  324. case "double":
  325. double tempDouble = PrimitiveCreator.CreateInstanceOfDouble(rndGen);
  326. sourceJson = (JsonPrimitive)JsonValue.Parse(tempDouble.ToString("R", NumberFormatInfo.InvariantInfo));
  327. sourceJson2 = new JsonPrimitive(tempDouble);
  328. break;
  329. case "guid":
  330. sourceJson2 = new JsonPrimitive(PrimitiveCreator.CreateInstanceOfGuid(rndGen));
  331. specialCase = true;
  332. break;
  333. case "int16":
  334. tempValue = PrimitiveCreator.CreateInstanceOfInt16(rndGen);
  335. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  336. sourceJson2 = new JsonPrimitive((short)tempValue);
  337. break;
  338. case "int32":
  339. tempValue = PrimitiveCreator.CreateInstanceOfInt32(rndGen);
  340. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  341. sourceJson2 = new JsonPrimitive((int)tempValue);
  342. break;
  343. case "int64":
  344. tempValue = PrimitiveCreator.CreateInstanceOfInt64(rndGen);
  345. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  346. sourceJson2 = new JsonPrimitive((long)tempValue);
  347. break;
  348. case "sbyte":
  349. tempValue = PrimitiveCreator.CreateInstanceOfSByte(rndGen);
  350. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  351. sourceJson2 = new JsonPrimitive((sbyte)tempValue);
  352. break;
  353. case "single":
  354. float fltValue = PrimitiveCreator.CreateInstanceOfSingle(rndGen);
  355. sourceJson = (JsonPrimitive)JsonValue.Parse(fltValue.ToString("R", NumberFormatInfo.InvariantInfo));
  356. sourceJson2 = new JsonPrimitive(fltValue);
  357. break;
  358. case "string":
  359. do
  360. {
  361. tempValue = PrimitiveCreator.CreateInstanceOfString(rndGen);
  362. } while (tempValue == null);
  363. sourceJson2 = new JsonPrimitive((string)tempValue);
  364. sourceJson = (JsonPrimitive)JsonValue.Parse(sourceJson2.ToString());
  365. break;
  366. case "uint16":
  367. tempValue = PrimitiveCreator.CreateInstanceOfUInt16(rndGen);
  368. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  369. sourceJson2 = new JsonPrimitive((ushort)tempValue);
  370. break;
  371. case "uint32":
  372. tempValue = PrimitiveCreator.CreateInstanceOfUInt32(rndGen);
  373. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  374. sourceJson2 = new JsonPrimitive((uint)tempValue);
  375. break;
  376. case "uint64":
  377. tempValue = PrimitiveCreator.CreateInstanceOfUInt64(rndGen);
  378. sourceJson = (JsonPrimitive)JsonValue.Parse(tempValue.ToString());
  379. sourceJson2 = new JsonPrimitive((ulong)tempValue);
  380. break;
  381. case "uri":
  382. Uri uri = null;
  383. do
  384. {
  385. try
  386. {
  387. uri = PrimitiveCreator.CreateInstanceOfUri(rndGen);
  388. }
  389. catch (UriFormatException)
  390. {
  391. }
  392. } while (uri == null);
  393. sourceJson2 = new JsonPrimitive(uri);
  394. specialCase = true;
  395. break;
  396. case "null":
  397. sourceJson = (JsonPrimitive)JsonValue.Parse("null");
  398. sourceJson2 = null;
  399. break;
  400. default:
  401. sourceJson = null;
  402. sourceJson2 = null;
  403. break;
  404. }
  405. if (!specialCase)
  406. {
  407. // comparison between two constructors
  408. if (!JsonValueVerifier.Compare(sourceJson, sourceJson2))
  409. {
  410. Log.Info("(JsonPrimitive)JsonValue.Parse(string) failed to match the results from default JsonPrimitive(obj)constructor for type {0}", typeName);
  411. retValue = false;
  412. }
  413. if (sourceJson != null)
  414. {
  415. // test JsonValue.Load(TextReader)
  416. JsonPrimitive newJson = null;
  417. using (StringReader sr = new StringReader(sourceJson.ToString()))
  418. {
  419. newJson = (JsonPrimitive)JsonValue.Load(sr);
  420. }
  421. if (!JsonValueVerifier.Compare(sourceJson, newJson))
  422. {
  423. Log.Info("JsonValue.Load(TextReader) failed to function properly for type {0}", typeName);
  424. retValue = false;
  425. }
  426. // test JsonValue.Load(Stream) is located in the JObjectFromGenoTypeLib test case
  427. // test JsonValue.Parse(string)
  428. newJson = null;
  429. newJson = (JsonPrimitive)JsonValue.Parse(sourceJson.ToString());
  430. if (!JsonValueVerifier.Compare(sourceJson, newJson))
  431. {
  432. Log.Info("JsonValue.Parse(string) failed to function properly for type {0}", typeName);
  433. retValue = false;
  434. }
  435. }
  436. }
  437. else
  438. {
  439. // test JsonValue.Load(TextReader)
  440. JsonPrimitive newJson2 = null;
  441. using (StringReader sr = new StringReader(sourceJson2.ToString()))
  442. {
  443. newJson2 = (JsonPrimitive)JsonValue.Load(sr);
  444. }
  445. if (!JsonValueVerifier.Compare(sourceJson2, newJson2))
  446. {
  447. Log.Info("JsonValue.Load(TextReader) failed to function properly for type {0}", typeName);
  448. retValue = false;
  449. }
  450. // test JsonValue.Load(Stream) is located in the JObjectFromGenoTypeLib test case
  451. // test JsonValue.Parse(string)
  452. newJson2 = null;
  453. newJson2 = (JsonPrimitive)JsonValue.Parse(sourceJson2.ToString());
  454. if (!JsonValueVerifier.Compare(sourceJson2, newJson2))
  455. {
  456. Log.Info("JsonValue.Parse(string) failed to function properly for type {0}", typeName);
  457. retValue = false;
  458. }
  459. }
  460. return retValue;
  461. }
  462. private void DoRoundTripCasting(JsonValue jo, Type type)
  463. {
  464. bool result = false;
  465. // Casting
  466. if (jo.JsonType == JsonType.String)
  467. {
  468. JsonValue jstr = (string)jo;
  469. if (type == typeof(DateTime))
  470. {
  471. Log.Info("{0} Value:{1}", type.Name, ((DateTime)jstr).ToString(DateTimeFormatInfo.InvariantInfo));
  472. }
  473. else if (type == typeof(DateTimeOffset))
  474. {
  475. Log.Info("{0} Value:{1}", type.Name, ((DateTimeOffset)jstr).ToString(DateTimeFormatInfo.InvariantInfo));
  476. }
  477. else if (type == typeof(Guid))
  478. {
  479. Log.Info("{0} Value:{1}", type.Name, (Guid)jstr);
  480. }
  481. else if (type == typeof(char))
  482. {
  483. Log.Info("{0} Value:{1}", type.Name, (char)jstr);
  484. }
  485. else if (type == typeof(Uri))
  486. {
  487. Log.Info("{0} Value:{1}", type.Name, ((Uri)jstr).AbsoluteUri);
  488. }
  489. else
  490. {
  491. Log.Info("{0} Value:{1}", type.Name, (string)jstr);
  492. }
  493. if (jo.ToString() == jstr.ToString())
  494. {
  495. result = true;
  496. }
  497. }
  498. else if (jo.JsonType == JsonType.Object)
  499. {
  500. JsonObject jobj = new JsonObject((JsonObject)jo);
  501. if (jo.ToString() == jobj.ToString())
  502. {
  503. result = true;
  504. }
  505. }
  506. else if (jo.JsonType == JsonType.Number)
  507. {
  508. JsonPrimitive jprim = (JsonPrimitive)jo;
  509. Log.Info("{0} Value:{1}", type.Name, jprim);
  510. if (jo.ToString() == jprim.ToString())
  511. {
  512. result = true;
  513. }
  514. }
  515. else if (jo.JsonType == JsonType.Boolean)
  516. {
  517. JsonPrimitive jprim = (JsonPrimitive)jo;
  518. Log.Info("{0} Value:{1}", type.Name, (bool)jprim);
  519. if (jo.ToString() == jprim.ToString())
  520. {
  521. result = true;
  522. }
  523. }
  524. Assert.True(result);
  525. }
  526. }
  527. }