Skip to content

Commit 4763a5e

Browse files
committed
Add test for constructor
1 parent 783b067 commit 4763a5e

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

AngleSharp.Io.Tests/Network/ResponseTests.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace AngleSharp.Io.Tests.Network
22
{
33
using System;
4+
using System.Collections.Generic;
45
using System.IO;
6+
using System.Net;
57
using AngleSharp.Io.Network;
68
using FluentAssertions;
79
using NUnit.Framework;
@@ -10,17 +12,40 @@
1012
public class ResponseTests
1113
{
1214
[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()
1430
{
1531
// ARRANGE
1632
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+
};
1842

1943
// ACT
2044
response.Dispose();
2145

2246
// ASSERT
2347
stream.Disposed.Should().BeTrue();
48+
response.Headers.Should().BeEmpty();
2449
}
2550

2651
[Test]
@@ -35,6 +60,7 @@ public void DisposesNothingWhenContentIsNull()
3560
// ASSERT
3661
action.ShouldNotThrow();
3762
}
63+
3864
class DisposableStream : Stream
3965
{
4066
public override Boolean CanRead

0 commit comments

Comments
 (0)