@@ -91,7 +91,7 @@ public void BasicReadWriteTests()
9191 // Assert
9292 for ( int i = 0 ; i < toSend . Length ; i ++ )
9393 {
94- Assert . Equal ( toSend [ i ] , toReceive [ i ] ) ;
94+ Assert . AreEqual ( toSend [ i ] , toReceive [ i ] ) ;
9595 }
9696 }
9797
@@ -109,7 +109,7 @@ public void VerifyDefaultReadLineCharacter()
109109 _serOne . Write ( toSend ) ;
110110 string toReceive = _serTwo . ReadLine ( ) ;
111111 // Assert
112- Assert . Equal ( toSend , toReceive + "\\ r" + _serOne . NewLine ) ;
112+ Assert . AreEqual ( toSend , toReceive + "\\ r" + _serOne . NewLine ) ;
113113 }
114114
115115 [ TestMethod ]
@@ -126,7 +126,7 @@ public void WriteAndReadStringTests()
126126 _serOne . WriteLine ( toSend ) ;
127127 string toReceive = _serTwo . ReadLine ( ) ;
128128 // Assert
129- Assert . Equal ( toSend + _serOne . NewLine , toReceive ) ;
129+ Assert . AreEqual ( toSend + _serOne . NewLine , toReceive ) ;
130130 }
131131
132132 [ TestMethod ]
@@ -143,11 +143,11 @@ public void ReadMultipleLinesTests()
143143 _serOne . WriteLine ( toSend ) ;
144144 string toReceive = _serTwo . ReadLine ( ) ;
145145 // Assert
146- Assert . Equal ( $ "Hi, this is a simple test with string{ _serOne . NewLine } ", toReceive ) ;
146+ Assert . AreEqual ( $ "Hi, this is a simple test with string{ _serOne . NewLine } ", toReceive ) ;
147147 toReceive = _serTwo . ReadLine ( ) ;
148- Assert . Equal ( $ "And with a second line{ _serOne . NewLine } ", toReceive ) ;
148+ Assert . AreEqual ( $ "And with a second line{ _serOne . NewLine } ", toReceive ) ;
149149 toReceive = _serTwo . ReadLine ( ) ;
150- Assert . Equal ( $ "Only line by line should be read{ _serOne . NewLine } ", toReceive ) ;
150+ Assert . AreEqual ( $ "Only line by line should be read{ _serOne . NewLine } ", toReceive ) ;
151151 }
152152
153153 [ TestMethod ]
@@ -164,17 +164,17 @@ public void CheckReadByteSize()
164164 // Wait a bit to have data sent
165165 Thread . Sleep ( 100 ) ;
166166 // Assert
167- Assert . Equal ( enc , _serTwo . BytesToRead ) ;
167+ Assert . AreEqual ( enc , _serTwo . BytesToRead ) ;
168168 // Read remaining
169169 string sent = _serTwo . ReadExisting ( ) ;
170- Assert . Equal ( toSend , sent ) ;
170+ Assert . AreEqual ( toSend , sent ) ;
171171 }
172172
173173 [ TestMethod ]
174174 public void CheckReadLineWithoutAnything ( )
175175 {
176176 long dtOrigine = DateTime . UtcNow . Ticks ;
177- Assert . Throws ( typeof ( TimeoutException ) , ( ) =>
177+ Assert . ThrowsException ( typeof ( TimeoutException ) , ( ) =>
178178 {
179179 // Arrange
180180 EnsurePortsOpen ( ) ;
@@ -185,14 +185,15 @@ public void CheckReadLineWithoutAnything()
185185 var nothingToRead = _serTwo . ReadLine ( ) ;
186186 // Assert
187187 } ) ;
188+
188189 long dtTimeout = DateTime . UtcNow . Ticks ;
189- Assert . True ( dtTimeout >= dtOrigine + _serTwo . ReadTimeout * TimeSpan . TicksPerMillisecond ) ;
190+ Assert . IsTrue ( dtTimeout >= dtOrigine + _serTwo . ReadTimeout * TimeSpan . TicksPerMillisecond ) ;
190191 }
191192
192193 [ TestMethod ]
193194 public void CheckReadTimeoutTest ( )
194195 {
195- Assert . Throws ( typeof ( TimeoutException ) , ( ) =>
196+ Assert . ThrowsException ( typeof ( TimeoutException ) , ( ) =>
196197 {
197198 // Arrange
198199 EnsurePortsOpen ( ) ;
@@ -225,7 +226,7 @@ public void ReadByteWriteByteTests()
225226 Thread . Sleep ( 100 ) ;
226227 toRead = ( byte ) _serTwo . ReadByte ( ) ;
227228 // Assert
228- Assert . Equal ( toWrite [ 1 ] , toRead ) ;
229+ Assert . AreEqual ( toWrite [ 1 ] , toRead ) ;
229230 }
230231
231232 [ TestMethod ]
@@ -248,19 +249,19 @@ public void CheckBytesAvailableTest()
248249 // Clean
249250 EnsurePortEmpty ( _serTwo ) ;
250251 // Assert
251- Assert . Equal ( lotsOfBytes . Length , numBytes ) ;
252+ Assert . AreEqual ( lotsOfBytes . Length , numBytes ) ;
252253 }
253254
254255 [ TestMethod ]
255256 public void TryReadWriteWhileClosed ( )
256257 {
257258 EnsurePortsClosed ( ) ;
258- Assert . Throws ( typeof ( InvalidOperationException ) , ( ) =>
259+ Assert . ThrowsException ( typeof ( InvalidOperationException ) , ( ) =>
259260 {
260261 _serOne . Write ( "Something" ) ;
261262 } ) ;
262263
263- Assert . Throws ( typeof ( InvalidOperationException ) , ( ) =>
264+ Assert . ThrowsException ( typeof ( InvalidOperationException ) , ( ) =>
264265 {
265266 byte [ ] something = new byte [ 5 ] ;
266267 _serOne . Read ( something , 0 , something . Length ) ;
@@ -312,7 +313,7 @@ public void TestStreams()
312313 // Assert
313314 for ( int i = 0 ; i < toSend . Length ; i ++ )
314315 {
315- Assert . Equal ( toSend [ i ] , toReceive [ i ] ) ;
316+ Assert . AreEqual ( toSend [ i ] , toReceive [ i ] ) ;
316317 }
317318 }
318319
@@ -340,8 +341,8 @@ private void DataReceivedNormalEventTest(object sender, SerialDataReceivedEventA
340341 {
341342 var ser = ( SerialPort ) sender ;
342343 Debug . WriteLine ( $ "Event fired, number of bytes ready to read: { ser . BytesToRead } ") ;
343- Assert . Equal ( 8 , ser . BytesToRead ) ;
344- Assert . True ( e . EventType == SerialData . Chars ) ;
344+ Assert . AreEqual ( 8 , ser . BytesToRead ) ;
345+ Assert . IsTrue ( e . EventType == SerialData . Chars ) ;
345346 }
346347
347348 [ TestMethod ]
@@ -368,7 +369,7 @@ private void DataReceivedWatchChar(object sender, SerialDataReceivedEventArgs e)
368369 {
369370 var ser = ( SerialPort ) sender ;
370371 Debug . WriteLine ( $ "Event fired, number of bytes ready to read: { ser . BytesToRead } ") ;
371- Assert . True ( e . EventType == SerialData . WatchChar ) ;
372+ Assert . IsTrue ( e . EventType == SerialData . WatchChar ) ;
372373 }
373374
374375 private void SendAndReceiveBasic ( )
@@ -385,7 +386,7 @@ private void SendAndReceiveBasic()
385386 // Assert
386387 for ( int i = 0 ; i < toSend . Length ; i ++ )
387388 {
388- Assert . Equal ( toSend [ i ] , toReceive [ i ] ) ;
389+ Assert . AreEqual ( toSend [ i ] , toReceive [ i ] ) ;
389390 }
390391 }
391392
0 commit comments