1+ using NUnit . Framework ;
2+
3+ [ TestFixture ]
4+ public class HexadecimalTest
5+ {
6+ // change Ignore to false to run test case or just remove 'Ignore = true'
7+ [ TestCase ( "1" , Result = 1 ) ]
8+ [ TestCase ( "c" , Result = 12 , Ignore = true ) ]
9+ [ TestCase ( "10" , Result = 16 , Ignore = true ) ]
10+ [ TestCase ( "af" , Result = 175 , Ignore = true ) ]
11+ [ TestCase ( "100" , Result = 256 , Ignore = true ) ]
12+ [ TestCase ( "19ace" , Result = 105166 , Ignore = true ) ]
13+ [ TestCase ( "19ace" , Result = 105166 , Ignore = true ) ]
14+ public int Hexadecimal_converts_to_decimal ( string hexadecimal )
15+ {
16+ return Hexadecimal . ToDecimal ( hexadecimal ) ;
17+ }
18+
19+ [ Ignore ]
20+ [ Test ]
21+ public void Invalid_hexadecimal_is_decimal_0 ( )
22+ {
23+ Assert . That ( Hexadecimal . ToDecimal ( "carrot" ) , Is . EqualTo ( 0 ) ) ;
24+ }
25+
26+ [ TestCase ( "000000" , Result = 0 , Ignore = true ) ]
27+ [ TestCase ( "ffffff" , Result = 16777215 , Ignore = true ) ]
28+ [ TestCase ( "ffff00" , Result = 16776960 , Ignore = true ) ]
29+ public int Octal_can_convert_formatted_strings ( string hexidecimal )
30+ {
31+ return Hexadecimal . ToDecimal ( hexidecimal ) ;
32+ }
33+ }
0 commit comments