@@ -27,11 +27,11 @@ public void NetTest1_DNS()
2727 {
2828 IPHostEntry ipHostEntry = Dns . GetHostEntry ( "192.168.1.1" ) ;
2929
30- Assert . Equal ( ipHostEntry . AddressList . Length , 1 , "GetHostEntry returned wrong number of addresses" ) ;
30+ Assert . AreEqual ( 1 , ipHostEntry . AddressList . Length , "GetHostEntry returned wrong number of addresses" ) ;
3131 IPAddress address = ipHostEntry . AddressList [ 0 ] ;
3232
33- Assert . NotNull ( address , "Address is null" ) ;
34- Assert . Equal ( address . ToString ( ) , "192.168.1.1" , "Address is incorrect" ) ;
33+ Assert . IsNotNull ( address , "Address is null" ) ;
34+ Assert . AreEqual ( "192.168.1.1" , address . ToString ( ) , "Address is incorrect" ) ;
3535 }
3636
3737 [ TestMethod ]
@@ -54,25 +54,25 @@ public void NetTest2_IPAddressBasic()
5454 + IPInts [ 1 ] * 256
5555 + IPInts [ 2 ] * 256 * 256
5656 + IPInts [ 3 ] * 256 * 256 * 256 ) ;
57- Assert . NotNull ( address , "Address is null" ) ;
57+ Assert . IsNotNull ( address , "Address is null" ) ;
5858
5959 Type typeOfAddress = address . GetType ( ) ;
60- Assert . IsType ( typeOfAddress , Type . GetType ( "System.Net.IPAddress" ) , "Type is incorrect" ) ;
60+ Assert . IsInstanceOfType ( typeOfAddress , Type . GetType ( "System.Net.IPAddress" ) , "Type is incorrect" ) ;
6161
6262 byte [ ] targetBytes = { ( byte ) IPInts [ 0 ] , ( byte ) IPInts [ 1 ] , ( byte ) IPInts [ 2 ] , ( byte ) IPInts [ 3 ] } ;
6363 byte [ ] addressBytes = address . GetAddressBytes ( ) ;
64- Assert . Equal ( addressBytes . Length , 4 , "GetAddressBytes returns wrong size" ) ;
64+ Assert . AreEqual ( 4 , addressBytes . Length , "GetAddressBytes returns wrong size" ) ;
6565
6666 for ( int j = 0 ; j < 4 ; j ++ )
6767 {
68- Assert . Equal ( addressBytes [ j ] , targetBytes [ j ] , "GetAddressBytes returns wrong bytes" ) ;
68+ Assert . AreEqual ( targetBytes [ j ] , addressBytes [ j ] , "GetAddressBytes returns wrong bytes" ) ;
6969 }
7070
7171 IPAddress addressFromByteArray = new ( targetBytes ) ;
7272 addressBytes = addressFromByteArray . GetAddressBytes ( ) ;
7373 for ( int j = 0 ; j < 4 ; j ++ )
7474 {
75- Assert . Equal ( addressBytes [ j ] , targetBytes [ j ] , "Address from byte array returns wrong bytes" ) ;
75+ Assert . AreEqual ( targetBytes [ j ] , addressBytes [ j ] , "Address from byte array returns wrong bytes" ) ;
7676 }
7777
7878 IPAddress address2 = new (
@@ -81,17 +81,17 @@ public void NetTest2_IPAddressBasic()
8181 + IPInts [ 2 ] * 256 * 256
8282 + IPInts [ 3 ] * 256 * 256 * 256 ) ;
8383
84- Assert . Equal ( address . ToString ( ) , address2 . ToString ( ) , "ToString returns differently for same data" ) ;
84+ Assert . AreEqual ( address2 . ToString ( ) , address . ToString ( ) , "ToString returns differently for same data" ) ;
8585
86- Assert . Equal ( address . GetHashCode ( ) , address2 . GetHashCode ( ) , "GetHasCode returns differently for same data" ) ;
86+ Assert . AreEqual ( address2 . GetHashCode ( ) , address . GetHashCode ( ) , "GetHasCode returns differently for same data" ) ;
8787
8888 address2 = new IPAddress (
8989 ( IPInts [ 0 ] % 2 + 1 )
9090 + ( IPInts [ 1 ] % 2 + 1 ) * 256
9191 + ( IPInts [ 2 ] % 2 + 1 ) * 256 * 256
9292 + ( IPInts [ 3 ] % 2 + 1 ) * 256 * 256 * 256 ) ;
9393
94- Assert . NotEqual ( address . GetHashCode ( ) , address2 . GetHashCode ( ) , "GetHasCode returns same for " + address . ToString ( )
94+ Assert . AreNotEqual ( address2 . GetHashCode ( ) , address . GetHashCode ( ) , "GetHasCode returns same for " + address . ToString ( )
9595 + " as " + address2 . ToString ( ) ) ;
9696 }
9797 }
@@ -100,20 +100,20 @@ public void NetTest2_IPAddressBasic()
100100 public void NetTest3_IPAddressLoopback ( )
101101 {
102102 IPAddress address = IPAddress . Loopback ;
103- Assert . NotNull ( address , "Address is null" ) ;
103+ Assert . IsNotNull ( address , "Address is null" ) ;
104104
105- Assert . Equal ( address . ToString ( ) , "127.0.0.1" , "Address is incorrect" ) ;
105+ Assert . AreEqual ( "127.0.0.1" , address . ToString ( ) , "Address is incorrect" ) ;
106106
107107 Type typeOfAddress = address . GetType ( ) ;
108- Assert . IsType ( typeOfAddress , Type . GetType ( "System.Net.IPAddress" ) , "Type is incorrect" ) ;
108+ Assert . IsInstanceOfType ( typeOfAddress , Type . GetType ( "System.Net.IPAddress" ) , "Type is incorrect" ) ;
109109
110110 byte [ ] localhostBytes = { 127 , 0 , 0 , 1 } ;
111111 byte [ ] addressBytes = address . GetAddressBytes ( ) ;
112- Assert . Equal ( addressBytes . Length , 4 , "GetAddressBytes returns wrong size" ) ;
112+ Assert . AreEqual ( 4 , addressBytes . Length , "GetAddressBytes returns wrong size" ) ;
113113
114114 for ( int i = 0 ; i < 4 ; i ++ )
115115 {
116- Assert . Equal ( addressBytes [ i ] , localhostBytes [ i ] , "GetAddressBytes returns wrong bytes" ) ;
116+ Assert . AreEqual ( localhostBytes [ i ] , addressBytes [ i ] , "GetAddressBytes returns wrong bytes" ) ;
117117 }
118118 }
119119
@@ -123,20 +123,20 @@ public void NetTest4_IPAddressAny()
123123 {
124124 IPAddress address = IPAddress . Any ;
125125
126- Assert . NotNull ( address , "Address is null" ) ;
126+ Assert . IsNotNull ( address , "Address is null" ) ;
127127
128- Assert . Equal ( address . ToString ( ) , "0.0.0.0" , "Address is incorrect" ) ;
128+ Assert . AreEqual ( "0.0.0.0" , address . ToString ( ) , "Address is incorrect" ) ;
129129
130130 Type typeOfAddress = address . GetType ( ) ;
131- Assert . IsType ( typeOfAddress , Type . GetType ( "System.Net.IPAddress" ) , "Type is incorrect" ) ;
131+ Assert . IsInstanceOfType ( typeOfAddress , Type . GetType ( "System.Net.IPAddress" ) , "Type is incorrect" ) ;
132132
133133 byte [ ] localhostBytes = { 0 , 0 , 0 , 0 } ;
134134 byte [ ] addressBytes = address . GetAddressBytes ( ) ;
135- Assert . Equal ( addressBytes . Length , 4 , "GetAddressBytes returns wrong size" ) ;
135+ Assert . AreEqual ( 4 , addressBytes . Length , "GetAddressBytes returns wrong size" ) ;
136136
137137 for ( int i = 0 ; i < 4 ; i ++ )
138138 {
139- Assert . Equal ( addressBytes [ i ] , localhostBytes [ i ] , "GetAddressBytes returns wrong bytes" ) ;
139+ Assert . AreEqual ( localhostBytes [ i ] , addressBytes [ i ] , "GetAddressBytes returns wrong bytes" ) ;
140140 }
141141 }
142142
@@ -171,47 +171,47 @@ public void NetTest5_IPEndPointBasic()
171171 Debug . WriteLine ( "EndPoint2 created with long and int" ) ;
172172 IPEndPoint endPoint2 = new ( addressLong , portInt ) ;
173173
174- Assert . NotNull ( endPoint1 , "EndPoint1 is null" ) ;
175- Assert . NotNull ( endPoint2 , "EndPoint2 is null" ) ;
174+ Assert . IsNotNull ( endPoint1 , "EndPoint1 is null" ) ;
175+ Assert . IsNotNull ( endPoint2 , "EndPoint2 is null" ) ;
176176
177177 Type typeOfEndPoint = endPoint1 . GetType ( ) ;
178- Assert . IsType ( typeOfEndPoint , Type . GetType ( "System.Net.IPEndPoint" ) , "EndPoint1 Type is incorrect" ) ;
178+ Assert . IsInstanceOfType ( typeOfEndPoint , Type . GetType ( "System.Net.IPEndPoint" ) , "EndPoint1 Type is incorrect" ) ;
179179
180180 typeOfEndPoint = endPoint2 . GetType ( ) ;
181- Assert . IsType ( typeOfEndPoint , Type . GetType ( "System.Net.IPEndPoint" ) , "EndPoint2 Type is incorrect" ) ;
181+ Assert . IsInstanceOfType ( typeOfEndPoint , Type . GetType ( "System.Net.IPEndPoint" ) , "EndPoint2 Type is incorrect" ) ;
182182
183- Assert . Equal ( endPoint1 . ToString ( ) , endPoint2 . ToString ( ) , "ToString returns differently for same data" ) ;
183+ Assert . AreEqual ( endPoint2 . ToString ( ) , endPoint1 . ToString ( ) , "ToString returns differently for same data" ) ;
184184
185- Assert . True ( endPoint1 . Equals ( endPoint2 ) , "Equals returns false for same data" ) ;
185+ Assert . IsTrue ( endPoint1 . Equals ( endPoint2 ) , "Equals returns false for same data" ) ;
186186
187187 int hashCode1 = endPoint1 . GetHashCode ( ) ;
188188 int hashCode2 = endPoint2 . GetHashCode ( ) ;
189189
190- Assert . Equal ( hashCode1 , hashCode2 , "GetHasCode returns differently for same data" ) ;
190+ Assert . AreEqual ( hashCode2 , hashCode1 , "GetHasCode returns differently for same data" ) ;
191191
192- Assert . False ( endPoint1 . Address . ToString ( ) != endPoint2 . Address . ToString ( )
192+ Assert . IsFalse ( endPoint1 . Address . ToString ( ) != endPoint2 . Address . ToString ( )
193193 || endPoint1 . Address . ToString ( ) != address . ToString ( )
194194 || endPoint2 . Address . ToString ( ) != address . ToString ( ) , "Address returns wrong data" ) ;
195195
196- Assert . False ( endPoint1 . Port != endPoint2 . Port
196+ Assert . IsFalse ( endPoint1 . Port != endPoint2 . Port
197197 || endPoint1 . Port != portInt
198198 || endPoint2 . Port != portInt , "Port returns wrong data" ) ;
199199
200200 Debug . WriteLine ( "Cloning Enpoint1 into EndPoint2" ) ;
201201 endPoint2 = ( IPEndPoint ) endPoint2 . Create ( endPoint1 . Serialize ( ) ) ;
202202
203203 typeOfEndPoint = endPoint2 . GetType ( ) ;
204- Assert . IsType ( typeOfEndPoint , Type . GetType ( "System.Net.IPEndPoint" ) , "EndPoint2 Type is incorrect after clone" ) ;
204+ Assert . IsInstanceOfType ( typeOfEndPoint , Type . GetType ( "System.Net.IPEndPoint" ) , "EndPoint2 Type is incorrect after clone" ) ;
205205
206- Assert . Equal ( endPoint1 . ToString ( ) , endPoint2 . ToString ( ) , "ToString returns differently for cloned data" ) ;
206+ Assert . AreEqual ( endPoint2 . ToString ( ) , endPoint1 . ToString ( ) , "ToString returns differently for cloned data" ) ;
207207
208- Assert . Equal ( endPoint1 . GetHashCode ( ) , endPoint2 . GetHashCode ( ) , "GetHashCode returns differently for cloned data" ) ;
208+ Assert . AreEqual ( endPoint2 . GetHashCode ( ) , endPoint1 . GetHashCode ( ) , "GetHashCode returns differently for cloned data" ) ;
209209
210- Assert . False ( endPoint1 . Address . ToString ( ) != endPoint2 . Address . ToString ( )
210+ Assert . IsFalse ( endPoint1 . Address . ToString ( ) != endPoint2 . Address . ToString ( )
211211 || endPoint1 . Address . ToString ( ) != address . ToString ( )
212212 || endPoint2 . Address . ToString ( ) != address . ToString ( ) , "Address returns wrong data after clone" ) ;
213213
214- Assert . False ( endPoint1 . Port != endPoint2 . Port
214+ Assert . IsFalse ( endPoint1 . Port != endPoint2 . Port
215215 || endPoint1 . Port != portInt
216216 || endPoint2 . Port != portInt , "Port returns wrong data after clone" ) ;
217217
@@ -225,14 +225,14 @@ public void NetTest5_IPEndPointBasic()
225225 + ( IPInts [ 3 ] % 2 + 1 ) * 256 * 256 * 256 ;
226226 endPoint2 = new IPEndPoint ( addressLong2 , portInt2 ) ;
227227
228- Assert . NotEqual ( endPoint1 . GetHashCode ( ) , endPoint2 . GetHashCode ( ) , "GetHashCode returns same for "
228+ Assert . AreNotEqual ( endPoint2 . GetHashCode ( ) , endPoint1 . GetHashCode ( ) , "GetHashCode returns same for "
229229 + endPoint1 . ToString ( )
230230 + " as " + endPoint2 . ToString ( ) ) ;
231231
232- Assert . False ( endPoint1 . Address == endPoint2 . Address
232+ Assert . IsFalse ( endPoint1 . Address == endPoint2 . Address
233233 || endPoint2 . Address == address , "Address returns wrong data after change" ) ;
234234
235- Assert . False ( endPoint1 . Port == endPoint2 . Port
235+ Assert . IsFalse ( endPoint1 . Port == endPoint2 . Port
236236 || endPoint2 . Port == portInt , "Port returns wrong data after change" ) ;
237237 }
238238 }
@@ -241,13 +241,13 @@ public void NetTest5_IPEndPointBasic()
241241 public void NetTest5_IPHostEntryBasic ( )
242242 {
243243 IPHostEntry ipHostEntry = Dns . GetHostEntry ( "192.168.1.1" ) ;
244- Assert . NotNull ( ipHostEntry , "IPHostEntry is null" ) ;
244+ Assert . IsNotNull ( ipHostEntry , "IPHostEntry is null" ) ;
245245
246246 Type typeOfIPHostEntry = ipHostEntry . GetType ( ) ;
247- Assert . IsType ( typeOfIPHostEntry , Type . GetType ( "System.Net.IPHostEntry" ) , "IPHostEntry Type is incorrect" ) ;
247+ Assert . IsInstanceOfType ( typeOfIPHostEntry , Type . GetType ( "System.Net.IPHostEntry" ) , "IPHostEntry Type is incorrect" ) ;
248248
249- Assert . Equal ( ipHostEntry . AddressList [ 0 ] . ToString ( ) , "192.168.1.1" , "AddressList[0] is incorrect" ) ;
250- Assert . Throws ( typeof ( IndexOutOfRangeException ) , ( ) => { ipHostEntry . AddressList [ 1 ] . ToString ( ) ; } ) ;
249+ Assert . AreEqual ( "192.168.1.1" , ipHostEntry . AddressList [ 0 ] . ToString ( ) , "AddressList[0] is incorrect" ) ;
250+ Assert . ThrowsException ( typeof ( IndexOutOfRangeException ) , ( ) => { ipHostEntry . AddressList [ 1 ] . ToString ( ) ; } ) ;
251251 }
252252
253253 [ TestMethod ]
@@ -278,25 +278,25 @@ public void NetTest6_SocketAddressBasic()
278278 SocketAddress socketAddress1 = ipEndpoint1 . Serialize ( ) ;
279279 SocketAddress socketAddress2 = ipEndpoint1 . Serialize ( ) ;
280280
281- Assert . NotNull ( socketAddress1 , "socketAddress1 is null" ) ;
282- Assert . NotNull ( socketAddress2 , "socketAddress2 is null" ) ;
281+ Assert . IsNotNull ( socketAddress1 , "socketAddress1 is null" ) ;
282+ Assert . IsNotNull ( socketAddress2 , "socketAddress2 is null" ) ;
283283
284284 Type typeOfSocketAddress = socketAddress1 . GetType ( ) ;
285- Assert . IsType ( typeOfSocketAddress , Type . GetType ( "System.Net.SocketAddress" ) , "socketAddress1 Type is incorrect" ) ;
285+ Assert . IsInstanceOfType ( typeOfSocketAddress , Type . GetType ( "System.Net.SocketAddress" ) , "socketAddress1 Type is incorrect" ) ;
286286
287287 typeOfSocketAddress = socketAddress2 . GetType ( ) ;
288- Assert . IsType ( typeOfSocketAddress , Type . GetType ( "System.Net.SocketAddress" ) , "socketAddress2 Type is incorrect" ) ;
288+ Assert . IsInstanceOfType ( typeOfSocketAddress , Type . GetType ( "System.Net.SocketAddress" ) , "socketAddress2 Type is incorrect" ) ;
289289
290- Assert . Equal ( socketAddress1 . ToString ( ) , socketAddress2 . ToString ( ) , "ToString returns differently for same data" ) ;
290+ Assert . AreEqual ( socketAddress2 . ToString ( ) , socketAddress1 . ToString ( ) , "ToString returns differently for same data" ) ;
291291
292- Assert . Equal ( socketAddress1 . GetHashCode ( ) , socketAddress2 . GetHashCode ( ) , $ "GetHashCode returns differently for same data") ;
293- Assert . True ( socketAddress1 . Family == AddressFamily . InterNetwork , "socketAddress1 Family is incorrect" ) ;
294- Assert . True ( socketAddress2 . Family == AddressFamily . InterNetwork , "socketAddress2 Family is incorrect" ) ;
292+ Assert . AreEqual ( socketAddress2 . GetHashCode ( ) , socketAddress1 . GetHashCode ( ) , $ "GetHashCode returns differently for same data") ;
293+ Assert . IsTrue ( socketAddress1 . Family == AddressFamily . InterNetwork , "socketAddress1 Family is incorrect" ) ;
294+ Assert . IsTrue ( socketAddress2 . Family == AddressFamily . InterNetwork , "socketAddress2 Family is incorrect" ) ;
295295
296296 // Recreate a different Socket
297297 socketAddress2 = new SocketAddress ( AddressFamily . Chaos , 8 ) ;
298298
299- Assert . NotEqual ( socketAddress1 . GetHashCode ( ) , socketAddress2 . GetHashCode ( ) , "GetHashCode returns same for "
299+ Assert . AreNotEqual ( socketAddress2 . GetHashCode ( ) , socketAddress1 . GetHashCode ( ) , "GetHashCode returns same for "
300300 + socketAddress1 . ToString ( ) + " " + socketAddress1 . GetHashCode ( )
301301 + " as " + socketAddress2 . ToString ( ) + " " + socketAddress2 . GetHashCode ( ) ) ;
302302 }
0 commit comments