@@ -60,11 +60,9 @@ public void PublicationTest()
6060 string json = JsonSerializer . Serialize ( comm ) ; // for system.text.json
6161
6262#if ! ROS2
63- Assert . AreEqual ( "{\" topic\" :\" mytopic\" ,\" msg\" :{\" secs\" :0,\" nsecs\" :0},\" op\" :\" publish\" ,\" id\" :\" myid\" }" ,
64- json ) ;
63+ Assert . That ( json , Is . EqualTo ( "{\" topic\" :\" mytopic\" ,\" msg\" :{\" secs\" :0,\" nsecs\" :0},\" op\" :\" publish\" ,\" id\" :\" myid\" }" ) ) ;
6564#else
66- Assert . AreEqual ( "{\" topic\" :\" mytopic\" ,\" msg\" :{\" sec\" :0,\" nanosec\" :0},\" op\" :\" publish\" ,\" id\" :\" myid\" }" ,
67- json ) ;
65+ Assert . That ( json , Is . EqualTo ( "{\" topic\" :\" mytopic\" ,\" msg\" :{\" sec\" :0,\" nanosec\" :0},\" op\" :\" publish\" ,\" id\" :\" myid\" }" ) ) ;
6866#endif
6967 //Console.WriteLine("JSON:\n" + JsonConvert.SerializeObject(comm, Formatting.Indented) + "\n"); // for newtonsoft
7068 Console . WriteLine ( "JSON:\n " + JsonSerializer . Serialize ( comm , JsonOptions ) + "\n " ) ; // for system.text.json
@@ -77,9 +75,9 @@ public void SubscriptionTest()
7775 //string json = JsonConvert.SerializeObject(comm); // for newtonsoft
7876 string json = JsonSerializer . Serialize ( comm ) ; // for system.text.json
7977
80- Assert . AreEqual ( "{\" topic\" :\" mytopic\" ,\" type\" :\" mytype\" ,\" throttle_rate\" :0,\" queue_length\" :1," +
81- "\" fragment_size\" :2147483647,\" compression\" :\" none\" ,\" op\" :\" subscribe\" ,\" id\" :\" myid\" }" ,
82- json ) ;
78+ Assert . That ( json , Is . EqualTo ( "{\" topic\" :\" mytopic\" ,\" type\" :\" mytype\" ,\" throttle_rate\" :0,\" queue_length\" :1," +
79+ "\" fragment_size\" :2147483647,\" compression\" :\" none\" ,\" op\" :\" subscribe\" ,\" id\" :\" myid\" }" ) ) ;
80+
8381 //Console.WriteLine("JSON:\n" + JsonConvert.SerializeObject(comm, Formatting.Indented) + "\n"); // for newtonsoft
8482 Console . WriteLine ( "JSON:\n " + JsonSerializer . Serialize ( comm , JsonOptions ) + "\n " ) ; // for system.text.json
8583 }
@@ -92,13 +90,11 @@ public void ServiceCallTest()
9290 string json = JsonSerializer . Serialize ( comm ) ; // for system.text.json
9391
9492#if ! ROS2
95- Assert . AreEqual ( "{\" service\" :\" myservice\" ,\" args\" :{\" secs\" :0,\" nsecs\" :0}," +
96- "\" fragment_size\" :2147483647,\" compression\" :\" none\" ,\" op\" :\" call_service\" ,\" id\" :\" myid\" }" ,
97- json ) ;
93+ Assert . That ( json , Is . EqualTo ( "{\" service\" :\" myservice\" ,\" args\" :{\" secs\" :0,\" nsecs\" :0}," +
94+ "\" fragment_size\" :2147483647,\" compression\" :\" none\" ,\" op\" :\" call_service\" ,\" id\" :\" myid\" }" ) ) ;
9895#else
99- Assert . AreEqual ( "{\" service\" :\" myservice\" ,\" args\" :{\" sec\" :0,\" nanosec\" :0}," +
100- "\" fragment_size\" :2147483647,\" compression\" :\" none\" ,\" op\" :\" call_service\" ,\" id\" :\" myid\" }" ,
101- json ) ;
96+ Assert . That ( json , Is . EqualTo ( "{\" service\" :\" myservice\" ,\" args\" :{\" sec\" :0,\" nanosec\" :0}," +
97+ "\" fragment_size\" :2147483647,\" compression\" :\" none\" ,\" op\" :\" call_service\" ,\" id\" :\" myid\" }" ) ) ;
10298#endif
10399 //Console.WriteLine("JSON:\n" + JsonConvert.SerializeObject(comm, Formatting.Indented) + "\n"); // for newtonsoft
104100 Console . WriteLine ( "JSON:\n " + JsonSerializer . Serialize ( comm , JsonOptions ) + "\n " ) ; // for system.text.json
0 commit comments