Skip to content

Commit 4ff3713

Browse files
committed
Fixed specific type of NotFoundResult in unit test
When content is included in the `NotFound` result, the `Controller` class returns a `NotFoundObjectResult`. When no content is included, however, it returns a `NotFoundResult`. As such, when I upaded the `[ValidateTopic]` action filter to return `NotFound()` without a specific error message (ab71a69), I also needed to update the `ValidateTopicAttributeTest` to correctly expect the `NotFoundResult` instead of the `NotFoundObjectResult`. Whoops.
1 parent 7a7b72e commit 4ff3713

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

OnTopic.AspNetCore.Mvc.Tests/ValidateTopicAttributeTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void InvalidControllerType_ThrowsException() {
111111
| TEST: NULL TOPIC: RETURNS NOT FOUND
112112
\-------------------------------------------------------------------------------------------------------------------------*/
113113
/// <summary>
114-
/// Ensures that a <see cref="NotFoundObjectResult"/> is thrown if the <see cref="TopicController.CurrentTopic"/> is null.
114+
/// Ensures that a <see cref="NotFoundResult"/> is thrown if the <see cref="TopicController.CurrentTopic"/> is null.
115115
/// </summary>
116116
[Fact]
117117
public void NullTopic_ReturnsNotFound() {
@@ -124,7 +124,7 @@ public void NullTopic_ReturnsNotFound() {
124124

125125
controller.Dispose();
126126

127-
Assert.IsType<NotFoundObjectResult>(context.Result);
127+
Assert.IsType<NotFoundResult>(context.Result);
128128

129129
}
130130

0 commit comments

Comments
 (0)