File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
AngleSharp.Io.Tests/Network Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change 1
1
namespace AngleSharp . Io . Tests . Network
2
2
{
3
3
using System ;
4
+ using System . Collections . Generic ;
4
5
using System . IO ;
6
+ using System . Net ;
5
7
using AngleSharp . Io . Network ;
6
8
using FluentAssertions ;
7
9
using NUnit . Framework ;
10
12
public class ResponseTests
11
13
{
12
14
[ Test ]
13
- public void DisposesContent ( )
15
+ public void Initialize ( )
16
+ {
17
+ // ARRANGE, ACT
18
+ var response = new Response ( ) ;
19
+
20
+ // ASSERT
21
+ response . Content . Should ( ) . BeNull ( ) ;
22
+ response . StatusCode . Should ( ) . Be ( HttpStatusCode . Accepted ) ;
23
+ response . Headers . Should ( ) . NotBeNull ( ) ;
24
+ response . Headers . Should ( ) . BeEmpty ( ) ;
25
+ response . Address . Should ( ) . BeNull ( ) ;
26
+ }
27
+
28
+ [ Test ]
29
+ public void DisposesContentAndHeaders ( )
14
30
{
15
31
// ARRANGE
16
32
var stream = new DisposableStream ( ) ;
17
- var response = new Response { Content = stream } ;
33
+ var response = new Response
34
+ {
35
+ Content = stream ,
36
+ Headers = new Dictionary < String , String >
37
+ {
38
+ { "Server" , "Fake" } ,
39
+ { "X-Foo" , "Bar" }
40
+ }
41
+ } ;
18
42
19
43
// ACT
20
44
response . Dispose ( ) ;
21
45
22
46
// ASSERT
23
47
stream . Disposed . Should ( ) . BeTrue ( ) ;
48
+ response . Headers . Should ( ) . BeEmpty ( ) ;
24
49
}
25
50
26
51
[ Test ]
@@ -35,6 +60,7 @@ public void DisposesNothingWhenContentIsNull()
35
60
// ASSERT
36
61
action . ShouldNotThrow ( ) ;
37
62
}
63
+
38
64
class DisposableStream : Stream
39
65
{
40
66
public override Boolean CanRead
You can’t perform that action at this time.
0 commit comments