File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ MyWebApi
119119 .ShouldReturn (typeof (IList <>)); // works with IEnumerable<> (or IList<ResponseModel>) too by using polymorphism
120120```
121121
122- #### OkResult
122+ #### Ok result
123123
124124``` c#
125125// tests whether the action returns OkResult
@@ -166,6 +166,16 @@ MyWebApi
166166 .Calling (c => c .SomeAction ())
167167 .ShouldReturnOk ()
168168 .WithResponseModel <ResponseModel >(m => m .Id == 1 );
169+
170+ // tests for model state errors for the response model (not very useful in practice)
171+ MyWebApi
172+ .Controller <WebApiController >()
173+ .Calling (c => c .SomeAction ())
174+ .ShouldReturnOk ()
175+ .WithResponseModel <ResponseModel >()
176+ .ContainingModelStateErrorFor (m => m .SomeProperty ).ThatEquals (" Error message" )
177+ .And ()
178+ .ContainingNoModelStateErrorFor (m => m .AnotherProperty );
169179```
170180
171181## Any questions, comments or additions?
You can’t perform that action at this time.
0 commit comments