1+ using System . Diagnostics ;
12using FluentAssertions . Primitives ;
23using FluentAssertions . Execution ;
3- using System ;
4- #if NETSTANDARD1_6
54using Microsoft . AspNetCore . Mvc ;
6- #else
7- using System . Web . Mvc ;
8- #endif
9- using System . Diagnostics ;
105
116namespace FluentAssertions . Mvc
127{
138 /// <summary>
149 /// Contains a number of methods to assert that an <see cref="ActionResult"/> is in the expected state.
1510 /// </summary>
1611 [ DebuggerNonUserCode ]
17- public class ActionResultAssertions : ObjectAssertions
18- {
12+ public class ActionResultAssertions : ObjectAssertions
13+ {
1914 public struct Constants
2015 {
2116 public const string CommonFailMessage = "Expected ActionResult to be {0}{reason}, but found {1}" ;
@@ -24,17 +19,15 @@ public struct Constants
2419 /// <summary>
2520 /// Initializes a new instance of the <see cref="T:ActionResultAssertions" /> class.
2621 /// </summary>
27- public ActionResultAssertions ( ActionResult subject ) : base ( subject )
28- {
29- Subject = subject ;
30- }
22+ public ActionResultAssertions ( ActionResult subject ) : base ( subject )
23+ {
24+ Subject = subject ;
25+ }
3126
32- #if NETSTANDARD1_6
3327 public ActionResultAssertions ( IActionResult subject ) : base ( subject )
3428 {
3529 Subject = subject ;
3630 }
37- #endif
3831
3932 /// <summary>
4033 /// Asserts that the subject is a <see cref="ContentResult"/>.
@@ -57,9 +50,9 @@ public ContentResultAssertions BeContentResult()
5750 public ContentResultAssertions BeContentResult ( string reason , params object [ ] reasonArgs )
5851 {
5952 Execute . Assertion
60- . BecauseOf ( reason , reasonArgs )
61- . ForCondition ( Subject is ContentResult )
62- . FailWith ( Constants . CommonFailMessage , typeof ( ContentResult ) . Name , Subject . GetType ( ) . Name ) ;
53+ . BecauseOf ( reason , reasonArgs )
54+ . ForCondition ( Subject is ContentResult )
55+ . FailWith ( Constants . CommonFailMessage , typeof ( ContentResult ) . Name , Subject . GetType ( ) . Name ) ;
6356
6457 return new ContentResultAssertions ( Subject as ContentResult ) ;
6558 }
@@ -85,9 +78,9 @@ public EmptyResult BeEmptyResult()
8578 public EmptyResult BeEmptyResult ( string reason , params object [ ] reasonArgs )
8679 {
8780 Execute . Assertion
88- . BecauseOf ( reason , reasonArgs )
89- . ForCondition ( Subject is EmptyResult )
90- . FailWith ( Constants . CommonFailMessage , typeof ( EmptyResult ) . Name , Subject . GetType ( ) . Name ) ;
81+ . BecauseOf ( reason , reasonArgs )
82+ . ForCondition ( Subject is EmptyResult )
83+ . FailWith ( Constants . CommonFailMessage , typeof ( EmptyResult ) . Name , Subject . GetType ( ) . Name ) ;
9184
9285 return Subject as EmptyResult ;
9386 }
@@ -113,9 +106,9 @@ public RedirectToRouteAssertions BeRedirectToRouteResult()
113106 public RedirectToRouteAssertions BeRedirectToRouteResult ( string reason , params object [ ] reasonArgs )
114107 {
115108 Execute . Assertion
116- . BecauseOf ( reason , reasonArgs )
117- . ForCondition ( Subject is RedirectToRouteResult )
118- . FailWith ( Constants . CommonFailMessage , typeof ( RedirectToRouteResult ) . Name , Subject . GetType ( ) . Name ) ;
109+ . BecauseOf ( reason , reasonArgs )
110+ . ForCondition ( Subject is RedirectToRouteResult )
111+ . FailWith ( Constants . CommonFailMessage , typeof ( RedirectToRouteResult ) . Name , Subject . GetType ( ) . Name ) ;
119112
120113 return new RedirectToRouteAssertions ( Subject as RedirectToRouteResult ) ;
121114 }
@@ -141,9 +134,9 @@ public PartialViewResultAssertions BePartialViewResult()
141134 public PartialViewResultAssertions BePartialViewResult ( string reason , params object [ ] reasonArgs )
142135 {
143136 Execute . Assertion
144- . BecauseOf ( reason , reasonArgs )
145- . ForCondition ( Subject is PartialViewResult )
146- . FailWith ( Constants . CommonFailMessage , typeof ( PartialViewResult ) . Name , Subject . GetType ( ) . Name ) ;
137+ . BecauseOf ( reason , reasonArgs )
138+ . ForCondition ( Subject is PartialViewResult )
139+ . FailWith ( Constants . CommonFailMessage , typeof ( PartialViewResult ) . Name , Subject . GetType ( ) . Name ) ;
147140
148141 return new PartialViewResultAssertions ( Subject as PartialViewResult ) ;
149142 }
@@ -169,9 +162,9 @@ public RedirectResultAssertions BeRedirectResult()
169162 public RedirectResultAssertions BeRedirectResult ( string reason , params object [ ] reasonArgs )
170163 {
171164 Execute . Assertion
172- . BecauseOf ( reason , reasonArgs )
173- . ForCondition ( Subject is RedirectResult )
174- . FailWith ( Constants . CommonFailMessage , "RedirectResult" , Subject . GetType ( ) . Name ) ;
165+ . BecauseOf ( reason , reasonArgs )
166+ . ForCondition ( Subject is RedirectResult )
167+ . FailWith ( Constants . CommonFailMessage , "RedirectResult" , Subject . GetType ( ) . Name ) ;
175168
176169 return new RedirectResultAssertions ( Subject as RedirectResult ) ;
177170 }
@@ -195,13 +188,13 @@ public ViewResultAssertions BeViewResult()
195188 /// Zero or more objects to format using the placeholders in <see cref="reason" />.
196189 /// </param>
197190 public ViewResultAssertions BeViewResult ( string reason , params object [ ] reasonArgs )
198- {
199- Execute . Assertion
200- . BecauseOf ( reason , reasonArgs )
201- . ForCondition ( Subject is ViewResult )
202- . FailWith ( Constants . CommonFailMessage , "ViewResult" , Subject . GetType ( ) . Name ) ;
191+ {
192+ Execute . Assertion
193+ . BecauseOf ( reason , reasonArgs )
194+ . ForCondition ( Subject is ViewResult )
195+ . FailWith ( Constants . CommonFailMessage , "ViewResult" , Subject . GetType ( ) . Name ) ;
203196
204- return new ViewResultAssertions ( Subject as ViewResult ) ;
205- }
206- }
207- }
197+ return new ViewResultAssertions ( Subject as ViewResult ) ;
198+ }
199+ }
200+ }
0 commit comments