This repository was archived by the owner on Dec 14, 2018. It is now read-only.
File tree 1 file changed +7
-0
lines changed
test/Microsoft.AspNet.Mvc.Core.Test/ActionResults
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ public async Task ViewResult_SetsContentTypeHeader(
110
110
var context = new ActionContext ( httpContext , new RouteData ( ) , new ActionDescriptor ( ) ) ;
111
111
var viewEngine = new Mock < IViewEngine > ( ) ;
112
112
var view = Mock . Of < IView > ( ) ;
113
+ var contentTypeBeforeViewResultExecution = contentType ? . ToString ( ) ;
113
114
114
115
viewEngine . Setup ( e => e . FindView ( context , "myview" ) )
115
116
. Returns ( ViewEngineResult . Found ( "myview" , view ) ) ;
@@ -126,6 +127,12 @@ public async Task ViewResult_SetsContentTypeHeader(
126
127
127
128
// Assert
128
129
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 ) ;
129
136
}
130
137
131
138
[ Fact ]
You can’t perform that action at this time.
0 commit comments