44using NUnit . Framework ;
55using System ;
66using System . Net . Sockets ;
7+ using System . Runtime . InteropServices ;
78using System . Threading ;
89
910namespace tests
@@ -183,8 +184,6 @@ public void TestBCR()
183184 Assert . AreEqual ( true , bcr . Adjusted ) ;
184185 Assert . AreEqual ( 0 , bcr . SequenceNumber ) ;
185186 Assert . AreEqual ( 0 , bcr . Value ) ;
186-
187-
188187 }
189188
190189 [ Test ( ) ]
@@ -264,7 +263,6 @@ public void TestClockSynchronizationCommand()
264263 Assert . AreEqual ( time . Minute , csc . NewTime . Minute ) ;
265264 Assert . AreEqual ( time . Second , csc . NewTime . Second ) ;
266265 Assert . AreEqual ( time . Millisecond , csc . NewTime . Millisecond ) ;
267-
268266 }
269267
270268 [ Test ( ) ]
@@ -343,7 +341,6 @@ public void TestEventOfProtectionEquipmentWithTime()
343341 Assert . AreEqual ( 45 , e . Timestamp . Minute ) ;
344342 Assert . AreEqual ( 23 , e . Timestamp . Second ) ;
345343 Assert . AreEqual ( 538 , e . Timestamp . Millisecond ) ;
346-
347344 }
348345
349346 [ Test ( ) ]
@@ -382,10 +379,8 @@ public void TestCounterInterrogationCommand()
382379
383380 Assert . AreEqual ( 101 , cic . ObjectAddress ) ;
384381 Assert . AreEqual ( 24 , cic . QCC ) ;
385-
386382 }
387383
388-
389384 [ Test ( ) ]
390385 public void TestSetpointCommandShort ( )
391386 {
@@ -406,7 +401,6 @@ public void TestSetpointCommandShort()
406401 Assert . AreEqual ( 102 , sc . ObjectAddress ) ;
407402 Assert . AreEqual ( - 1.0f , sc . Value , 0.001f ) ;
408403 Assert . AreEqual ( true , sc . QOS . Select ) ;
409-
410404 }
411405
412406 [ Test ( ) ]
@@ -451,7 +445,6 @@ public void TestSetpointCommandShortWithCP56Time2a()
451445 Assert . AreEqual ( time . Minute , sc . Timestamp . Minute ) ;
452446 Assert . AreEqual ( time . Second , sc . Timestamp . Second ) ;
453447 Assert . AreEqual ( time . Millisecond , sc . Timestamp . Millisecond ) ;
454-
455448 }
456449
457450 [ Test ( ) ]
@@ -479,7 +472,6 @@ public void TestSetpointCommandScaled()
479472 [ Test ( ) ]
480473 public void TestSetpointCommandScaledWithCP56Time2a ( )
481474 {
482-
483475 DateTime dateTime = DateTime . UtcNow ;
484476
485477 CP56Time2a time = new CP56Time2a ( dateTime ) ;
@@ -584,8 +576,6 @@ public void TestSetpointCommandNormalizedWithCP56Time2a()
584576 Assert . AreEqual ( time . Millisecond , sc . Timestamp . Millisecond ) ;
585577 }
586578
587-
588-
589579 [ Test ( ) ]
590580 public void TestStepPositionInformation ( )
591581 {
@@ -731,7 +721,16 @@ public void TestConnectWhileAlreadyConnected()
731721
732722 Assert . IsNotNull ( se ) ;
733723 Assert . AreEqual ( se . Message , "already connected" ) ;
734- Assert . AreEqual ( 10056 , ( ( SocketException ) se . InnerException ) . ErrorCode ) ;
724+
725+ if ( System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
726+ {
727+ Assert . AreEqual ( 106 , ( ( SocketException ) se . InnerException ) . ErrorCode ) ;
728+ }
729+
730+ if ( System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
731+ {
732+ Assert . AreEqual ( 10056 , ( ( SocketException ) se . InnerException ) . ErrorCode ) ;
733+ }
735734
736735 connection . Close ( ) ;
737736
@@ -765,8 +764,6 @@ private static bool EventQueue1_asduReceivedHandler(object param, ASDU asdu)
765764 return true ;
766765 }
767766
768-
769-
770767 [ Test ( ) ]
771768 public void TestAddUntilOverflow ( )
772769 {
@@ -940,7 +937,17 @@ public void TestSendIMessageAfterStopDT()
940937
941938 Assert . IsNotNull ( se ) ;
942939 Assert . AreEqual ( se . Message , "not connected" ) ;
943- Assert . AreEqual ( 10057 , ( ( SocketException ) se . InnerException ) . ErrorCode ) ;
940+
941+
942+ if ( System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
943+ {
944+ Assert . AreEqual ( 107 , ( ( SocketException ) se . InnerException ) . ErrorCode ) ;
945+ }
946+
947+ if ( System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
948+ {
949+ Assert . AreEqual ( 10057 , ( ( SocketException ) se . InnerException ) . ErrorCode ) ;
950+ }
944951
945952 server . Stop ( ) ;
946953 }
0 commit comments