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

Commit ba3b3e9

Browse files
committed
Modified test
1 parent 05d9de7 commit ba3b3e9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/Microsoft.AspNet.Mvc.Core.Test/ActionResults/ViewResultTest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public async Task ViewResult_SetsContentTypeHeader(
110110
var context = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());
111111
var viewEngine = new Mock<IViewEngine>();
112112
var view = Mock.Of<IView>();
113+
var contentTypeBeforeViewResultExecution = contentType?.ToString();
113114

114115
viewEngine.Setup(e => e.FindView(context, "myview"))
115116
.Returns(ViewEngineResult.Found("myview", view));
@@ -126,6 +127,12 @@ public async Task ViewResult_SetsContentTypeHeader(
126127

127128
// Assert
128129
Assert.Equal(expectedContentTypeHeaderValue, httpContext.Response.ContentType);
130+
131+
// Check if the original instance provided by the user has not changed.
132+
// Since we do not have access to the new instance created within the view executor,
133+
// check if at least the content is the same.
134+
var contentTypeAfterViewResultExecution = contentType?.ToString();
135+
Assert.Equal(contentTypeBeforeViewResultExecution, contentTypeAfterViewResultExecution);
129136
}
130137

131138
[Fact]

0 commit comments

Comments
 (0)