File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,16 @@ namespace UnitTestTcpSocket;
88
99public class BinConverterTest
1010{
11+ [ Fact ]
12+ public void ToHexString_Null ( )
13+ {
14+ var actual = BinConverter . ToString ( null ) ;
15+ Assert . Equal ( string . Empty , actual ) ;
16+
17+ actual = BinConverter . ToString ( [ ] ) ;
18+ Assert . Equal ( string . Empty , actual ) ;
19+ }
20+
1121 [ Fact ]
1222 public void ToBinString_Ok ( )
1323 {
@@ -19,6 +29,14 @@ public void ToBinString_Ok()
1929 Assert . Equal ( "00011010 00000010" , actual ) ;
2030 }
2131
32+ [ Fact ]
33+ public void ToHexString_Exception ( )
34+ {
35+ var data = "00011010-00000010" ;
36+ var ex = Assert . ThrowsAny < ArgumentException > ( ( ) => BinConverter . ToBytes ( data ) ) ;
37+ Assert . NotNull ( ex ) ;
38+ }
39+
2240 [ Fact ]
2341 public void ToBytes_Ok ( )
2442 {
Original file line number Diff line number Diff line change 1- // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
1+ // Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33// Website: https://www.blazor.zone or https://argozhang.github.io/
44
@@ -8,6 +8,24 @@ namespace UnitTestTcpSocket;
88
99public class HexConverterTest
1010{
11+ [ Fact ]
12+ public void ToHexString_Null ( )
13+ {
14+ var actual = HexConverter . ToString ( null ) ;
15+ Assert . Equal ( string . Empty , actual ) ;
16+
17+ actual = HexConverter . ToString ( [ ] ) ;
18+ Assert . Equal ( string . Empty , actual ) ;
19+ }
20+
21+ [ Fact ]
22+ public void ToHexString_Exception ( )
23+ {
24+ var data = "1A021304FE1" ;
25+ var ex = Assert . ThrowsAny < ArgumentException > ( ( ) => HexConverter . ToBytes ( data ) ) ;
26+ Assert . NotNull ( ex ) ;
27+ }
28+
1129 [ Fact ]
1230 public void ToHexString_Ok ( )
1331 {
You can’t perform that action at this time.
0 commit comments