Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit 14caa67

Browse files
committed
Change test exception
1 parent 0dd6ca3 commit 14caa67

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/Microsoft.AspNetCore.Server.KestrelTests/FrameResponseHeadersTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void ThrowsWhenAddingHeaderAfterReadOnlyIsSet()
102102
var headers = new FrameResponseHeaders();
103103
headers.SetReadOnly();
104104

105-
Assert.Throws<InvalidOperationException>(() => ((IDictionary<string, StringValues>)headers).Add("my-header", new[] { "value" }));
105+
Assert.Throws<BadHttpResponseException>(() => ((IDictionary<string, StringValues>)headers).Add("my-header", new[] { "value" }));
106106
}
107107

108108
[Fact]
@@ -113,7 +113,7 @@ public void ThrowsWhenChangingHeaderAfterReadOnlyIsSet()
113113
dictionary.Add("my-header", new[] { "value" });
114114
headers.SetReadOnly();
115115

116-
Assert.Throws<InvalidOperationException>(() => dictionary["my-header"] = "other-value");
116+
Assert.Throws<BadHttpResponseException>(() => dictionary["my-header"] = "other-value");
117117
}
118118

119119
[Fact]
@@ -124,7 +124,7 @@ public void ThrowsWhenRemovingHeaderAfterReadOnlyIsSet()
124124
dictionary.Add("my-header", new[] { "value" });
125125
headers.SetReadOnly();
126126

127-
Assert.Throws<InvalidOperationException>(() => dictionary.Remove("my-header"));
127+
Assert.Throws<BadHttpResponseException>(() => dictionary.Remove("my-header"));
128128
}
129129

130130
[Fact]
@@ -135,7 +135,7 @@ public void ThrowsWhenClearingHeadersAfterReadOnlyIsSet()
135135
dictionary.Add("my-header", new[] { "value" });
136136
headers.SetReadOnly();
137137

138-
Assert.Throws<InvalidOperationException>(() => dictionary.Clear());
138+
Assert.Throws<BadHttpResponseException>(() => dictionary.Clear());
139139
}
140140
}
141141
}

test/Microsoft.AspNetCore.Server.KestrelTests/FrameTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public void ThrowsWhenStatusCodeIsSetAfterResponseStarted()
415415

416416
// Assert
417417
Assert.True(frame.HasResponseStarted);
418-
Assert.Throws<InvalidOperationException>(() => ((IHttpResponseFeature)frame).StatusCode = 404);
418+
Assert.Throws<BadHttpResponseException>(() => ((IHttpResponseFeature)frame).StatusCode = 404);
419419
}
420420

421421
[Fact]
@@ -437,7 +437,7 @@ public void ThrowsWhenReasonPhraseIsSetAfterResponseStarted()
437437

438438
// Assert
439439
Assert.True(frame.HasResponseStarted);
440-
Assert.Throws<InvalidOperationException>(() => ((IHttpResponseFeature)frame).ReasonPhrase = "Reason phrase");
440+
Assert.Throws<BadHttpResponseException>(() => ((IHttpResponseFeature)frame).ReasonPhrase = "Reason phrase");
441441
}
442442

443443
[Fact]

0 commit comments

Comments
 (0)