@@ -46,25 +46,17 @@ public static IEnumerable<string> Decode(string str)
4646 return result ;
4747 }
4848
49- [ Fact ]
50- public void EncodeTest ( )
51- {
52- var ex1 = new List < string > { "abc" } ;
53- var ex2 = new List < string > { "abc" , "c : a" } ;
54-
55- Encode ( Array . Empty < string > ( ) ) . Should ( ) . Be ( string . Empty ) ;
56- Encode ( ex1 ) . Should ( ) . Be ( "3:abc" ) ;
57- Encode ( ex2 ) . Should ( ) . Be ( "3:abc5:c : a" ) ;
58- }
59-
60- [ Fact ]
61- public void DecodeTest ( )
62- {
63- const string ex1 = "3:abc" ;
64- const string ex2 = "3:abc5:c : a" ;
65-
66- Decode ( string . Empty ) . Should ( ) . BeEmpty ( ) ;
67- Decode ( ex1 ) . Should ( ) . Equal ( "abc" ) ;
68- Decode ( ex2 ) . Should ( ) . Equal ( "abc" , "c : a" ) ;
69- }
49+ [ Theory ]
50+ [ InlineData ( new string [ ] { } , "" ) ]
51+ [ InlineData ( new [ ] { "" } , "0:" ) ]
52+ [ InlineData ( new [ ] { "abc" } , "3:abc" ) ]
53+ [ InlineData ( new [ ] { "abc" , "c : a" } , "3:abc5:c : a" ) ]
54+ public void EncodeTest ( string [ ] strs , string expected ) => Encode ( strs ) . Should ( ) . Be ( expected ) ;
55+
56+ [ Theory ]
57+ [ InlineData ( "" , new string [ ] { } ) ]
58+ [ InlineData ( "0:" , new [ ] { "" } ) ]
59+ [ InlineData ( "3:abc" , new [ ] { "abc" } ) ]
60+ [ InlineData ( "3:abc5:c : a" , new [ ] { "abc" , "c : a" } ) ]
61+ public void DecodeTest ( string str , string [ ] expected ) => Decode ( str ) . Should ( ) . Equal ( expected ) ;
7062}
0 commit comments