File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44//
55
66using nanoFramework . TestFramework ;
7+ using System ;
78using System . Net ;
89
910namespace HttpUnitTests
@@ -68,5 +69,33 @@ public void Add_Authorization_ColonWithSpaceOnly()
6869 string value = headers [ "Authorization" ] ;
6970 Assert . AreEqual ( string . Empty , value ) ;
7071 }
72+
73+ [ TestMethod ]
74+ public void Add_NullHeader_ThrowsArgumentNullException ( )
75+ {
76+ var headers = new WebHeaderCollection ( ) ;
77+ Assert . ThrowsException ( typeof ( ArgumentNullException ) , ( ) => headers . Add ( null ) ) ;
78+ }
79+
80+ [ TestMethod ]
81+ public void Add_EmptyHeader_ThrowsArgumentNullException ( )
82+ {
83+ var headers = new WebHeaderCollection ( ) ;
84+ Assert . ThrowsException ( typeof ( ArgumentNullException ) , ( ) => headers . Add ( string . Empty ) ) ;
85+ }
86+
87+ [ TestMethod ]
88+ public void Add_HeaderWithNoColon_ThrowsArgumentException ( )
89+ {
90+ var headers = new WebHeaderCollection ( ) ;
91+ Assert . ThrowsException ( typeof ( ArgumentException ) , ( ) => headers . Add ( "Authorization" ) ) ;
92+ }
93+
94+ [ TestMethod ]
95+ public void Add_HeaderNameWithSpace_ThrowsArgumentException ( )
96+ {
97+ var headers = new WebHeaderCollection ( ) ;
98+ Assert . ThrowsException ( typeof ( ArgumentException ) , ( ) => headers . Add ( "My Header: value" ) ) ;
99+ }
71100 }
72101}
You can’t perform that action at this time.
0 commit comments