@@ -22,6 +22,7 @@ public void BeContent_GivenNotContent_ShouldFail()
2222 {
2323 ActionResult result = new ViewResult ( ) ;
2424 Action a = ( ) => result . Should ( ) . BeContentResult ( ) ;
25+
2526 a . Should ( ) . Throw < Exception > ( )
2627 . WithMessage ( "Expected ActionResult to be \" ContentResult\" , but found \" ViewResult\" " ) ;
2728 }
@@ -30,6 +31,7 @@ public void BeContent_GivenNotContent_ShouldFail()
3031 public void BeEmpty_GivenEmpty_ShouldPass ( )
3132 {
3233 ActionResult result = new EmptyResult ( ) ;
34+
3335 result . Should ( ) . BeEmptyResult ( ) ;
3436 }
3537
@@ -38,14 +40,36 @@ public void BeEmpty_GivenNotEmpty_ShouldPass()
3840 {
3941 ActionResult result = new ViewResult ( ) ;
4042 Action a = ( ) => result . Should ( ) . BeEmptyResult ( ) ;
43+
4144 a . Should ( ) . Throw < Exception > ( )
4245 . WithMessage ( "Expected ActionResult to be \" EmptyResult\" , but found \" ViewResult\" " ) ;
4346 }
4447
48+ [ Fact ]
49+ public void BeFileResult_GivenFileResult_ShouldPass ( )
50+ {
51+ ActionResult result = new FileContentResult ( Array . Empty < byte > ( ) , "text/plain" ) ;
52+
53+ result . Should ( )
54+ . BeFileResult ( ) ;
55+ }
56+
57+ [ Fact ]
58+ public void BeFileResult_GivenNotFileResult_ShouldFail ( )
59+ {
60+ ActionResult result = new ViewResult ( ) ;
61+ Action a = ( ) => result . Should ( ) . BeFileResult ( ) ;
62+
63+ a . Should ( ) . Throw < Exception > ( )
64+ . WithMessage ( "Expected ActionResult to be \" FileResult\" , but found \" ViewResult\" " ) ;
65+ }
66+
67+
4568 [ Fact ]
4669 public void BeJson_GivenJson_ShouldPass ( )
4770 {
4871 ActionResult result = new JsonResult ( new object ( ) ) ;
72+
4973 result . Should ( )
5074 . BeJsonResult ( ) ;
5175 }
@@ -55,6 +79,7 @@ public void BeJson_GivenNotJson_ShouldFail()
5579 {
5680 ActionResult result = new ViewResult ( ) ;
5781 Action a = ( ) => result . Should ( ) . BeJsonResult ( ) ;
82+
5883 a . Should ( ) . Throw < Exception > ( )
5984 . WithMessage ( "Expected ActionResult to be \" JsonResult\" , but found \" ViewResult\" " ) ;
6085 }
@@ -63,6 +88,7 @@ public void BeJson_GivenNotJson_ShouldFail()
6388 public void BeRedirectToRoute_GivenRedirectToRoute_ShouldPass ( )
6489 {
6590 ActionResult result = new RedirectToRouteResult ( new RouteValueDictionary ( ) ) ;
91+
6692 result . Should ( ) . BeRedirectToRouteResult ( ) ;
6793 }
6894
@@ -71,6 +97,7 @@ public void BeRedirectToRoute_GivenNotRedirectToRoute_ShouldFail()
7197 {
7298 ActionResult result = new ViewResult ( ) ;
7399 Action a = ( ) => result . Should ( ) . BeRedirectToRouteResult ( ) ;
100+
74101 a . Should ( ) . Throw < Exception > ( )
75102 . WithMessage ( "Expected ActionResult to be \" RedirectToRouteResult\" , but found \" ViewResult\" " ) ;
76103 }
@@ -79,6 +106,7 @@ public void BeRedirectToRoute_GivenNotRedirectToRoute_ShouldFail()
79106 public void BeRedirect_GivenRedirect_ShouldPass ( )
80107 {
81108 ActionResult result = new RedirectResult ( "/" ) ;
109+
82110 result . Should ( ) . BeRedirectResult ( ) ;
83111 }
84112
@@ -87,6 +115,7 @@ public void BeRedirect_GivenNotRedirect_ShouldFail()
87115 {
88116 ActionResult result = new ViewResult ( ) ;
89117 Action a = ( ) => result . Should ( ) . BeRedirectResult ( ) ;
118+
90119 a . Should ( ) . Throw < Exception > ( )
91120 . WithMessage ( "Expected ActionResult to be \" RedirectResult\" , but found \" ViewResult\" " ) ;
92121 }
@@ -95,6 +124,7 @@ public void BeRedirect_GivenNotRedirect_ShouldFail()
95124 public void BePartialView_GivenPartial_ShouldPass ( )
96125 {
97126 ActionResult result = new PartialViewResult ( ) ;
127+
98128 result . Should ( ) . BePartialViewResult ( ) ;
99129 }
100130
@@ -103,6 +133,7 @@ public void BePartialView_GivenNotPartial_ShouldFail()
103133 {
104134 ActionResult result = new RedirectResult ( "/" ) ;
105135 Action a = ( ) => result . Should ( ) . BePartialViewResult ( ) ;
136+
106137 a . Should ( ) . Throw < Exception > ( )
107138 . WithMessage ( "Expected ActionResult to be \" PartialViewResult\" , but found \" RedirectResult\" " ) ;
108139 }
@@ -111,6 +142,7 @@ public void BePartialView_GivenNotPartial_ShouldFail()
111142 public void BeView_GivenView_ShouldPass ( )
112143 {
113144 ActionResult result = new ViewResult ( ) ;
145+
114146 result . Should ( ) . BeViewResult ( ) ;
115147 }
116148
@@ -119,6 +151,7 @@ public void BeView_GivenNotView_ShouldFail()
119151 {
120152 ActionResult result = new RedirectResult ( "/" ) ;
121153 Action a = ( ) => result . Should ( ) . BeViewResult ( ) ;
154+
122155 a . Should ( ) . Throw < Exception > ( )
123156 . WithMessage ( "Expected ActionResult to be \" ViewResult\" , but found \" RedirectResult\" " ) ;
124157 }
@@ -127,6 +160,7 @@ public void BeView_GivenNotView_ShouldFail()
127160 public void BeStatusCodeResult_GivenStatusCodeResult_ShouldPass ( )
128161 {
129162 ActionResult result = new StatusCodeResult ( 200 ) ;
163+
130164 result . Should ( ) . BeStatusCodeResult ( ) ;
131165 }
132166
@@ -135,6 +169,7 @@ public void BeStatusCodeResult_GivenNotStatusCodeResult_ShouldFail()
135169 {
136170 ActionResult result = new RedirectResult ( "/" ) ;
137171 Action a = ( ) => result . Should ( ) . BeStatusCodeResult ( ) ;
172+
138173 a . Should ( ) . Throw < Exception > ( )
139174 . WithMessage ( "Expected ActionResult to be \" StatusCodeResult\" , but found \" RedirectResult\" " ) ;
140175 }
0 commit comments