@@ -22,6 +22,7 @@ public void BeContent_GivenNotContent_ShouldFail()
22
22
{
23
23
ActionResult result = new ViewResult ( ) ;
24
24
Action a = ( ) => result . Should ( ) . BeContentResult ( ) ;
25
+
25
26
a . Should ( ) . Throw < Exception > ( )
26
27
. WithMessage ( "Expected ActionResult to be \" ContentResult\" , but found \" ViewResult\" " ) ;
27
28
}
@@ -30,6 +31,7 @@ public void BeContent_GivenNotContent_ShouldFail()
30
31
public void BeEmpty_GivenEmpty_ShouldPass ( )
31
32
{
32
33
ActionResult result = new EmptyResult ( ) ;
34
+
33
35
result . Should ( ) . BeEmptyResult ( ) ;
34
36
}
35
37
@@ -38,14 +40,36 @@ public void BeEmpty_GivenNotEmpty_ShouldPass()
38
40
{
39
41
ActionResult result = new ViewResult ( ) ;
40
42
Action a = ( ) => result . Should ( ) . BeEmptyResult ( ) ;
43
+
41
44
a . Should ( ) . Throw < Exception > ( )
42
45
. WithMessage ( "Expected ActionResult to be \" EmptyResult\" , but found \" ViewResult\" " ) ;
43
46
}
44
47
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
+
45
68
[ Fact ]
46
69
public void BeJson_GivenJson_ShouldPass ( )
47
70
{
48
71
ActionResult result = new JsonResult ( new object ( ) ) ;
72
+
49
73
result . Should ( )
50
74
. BeJsonResult ( ) ;
51
75
}
@@ -55,6 +79,7 @@ public void BeJson_GivenNotJson_ShouldFail()
55
79
{
56
80
ActionResult result = new ViewResult ( ) ;
57
81
Action a = ( ) => result . Should ( ) . BeJsonResult ( ) ;
82
+
58
83
a . Should ( ) . Throw < Exception > ( )
59
84
. WithMessage ( "Expected ActionResult to be \" JsonResult\" , but found \" ViewResult\" " ) ;
60
85
}
@@ -63,6 +88,7 @@ public void BeJson_GivenNotJson_ShouldFail()
63
88
public void BeRedirectToRoute_GivenRedirectToRoute_ShouldPass ( )
64
89
{
65
90
ActionResult result = new RedirectToRouteResult ( new RouteValueDictionary ( ) ) ;
91
+
66
92
result . Should ( ) . BeRedirectToRouteResult ( ) ;
67
93
}
68
94
@@ -71,6 +97,7 @@ public void BeRedirectToRoute_GivenNotRedirectToRoute_ShouldFail()
71
97
{
72
98
ActionResult result = new ViewResult ( ) ;
73
99
Action a = ( ) => result . Should ( ) . BeRedirectToRouteResult ( ) ;
100
+
74
101
a . Should ( ) . Throw < Exception > ( )
75
102
. WithMessage ( "Expected ActionResult to be \" RedirectToRouteResult\" , but found \" ViewResult\" " ) ;
76
103
}
@@ -79,6 +106,7 @@ public void BeRedirectToRoute_GivenNotRedirectToRoute_ShouldFail()
79
106
public void BeRedirect_GivenRedirect_ShouldPass ( )
80
107
{
81
108
ActionResult result = new RedirectResult ( "/" ) ;
109
+
82
110
result . Should ( ) . BeRedirectResult ( ) ;
83
111
}
84
112
@@ -87,6 +115,7 @@ public void BeRedirect_GivenNotRedirect_ShouldFail()
87
115
{
88
116
ActionResult result = new ViewResult ( ) ;
89
117
Action a = ( ) => result . Should ( ) . BeRedirectResult ( ) ;
118
+
90
119
a . Should ( ) . Throw < Exception > ( )
91
120
. WithMessage ( "Expected ActionResult to be \" RedirectResult\" , but found \" ViewResult\" " ) ;
92
121
}
@@ -95,6 +124,7 @@ public void BeRedirect_GivenNotRedirect_ShouldFail()
95
124
public void BePartialView_GivenPartial_ShouldPass ( )
96
125
{
97
126
ActionResult result = new PartialViewResult ( ) ;
127
+
98
128
result . Should ( ) . BePartialViewResult ( ) ;
99
129
}
100
130
@@ -103,6 +133,7 @@ public void BePartialView_GivenNotPartial_ShouldFail()
103
133
{
104
134
ActionResult result = new RedirectResult ( "/" ) ;
105
135
Action a = ( ) => result . Should ( ) . BePartialViewResult ( ) ;
136
+
106
137
a . Should ( ) . Throw < Exception > ( )
107
138
. WithMessage ( "Expected ActionResult to be \" PartialViewResult\" , but found \" RedirectResult\" " ) ;
108
139
}
@@ -111,6 +142,7 @@ public void BePartialView_GivenNotPartial_ShouldFail()
111
142
public void BeView_GivenView_ShouldPass ( )
112
143
{
113
144
ActionResult result = new ViewResult ( ) ;
145
+
114
146
result . Should ( ) . BeViewResult ( ) ;
115
147
}
116
148
@@ -119,6 +151,7 @@ public void BeView_GivenNotView_ShouldFail()
119
151
{
120
152
ActionResult result = new RedirectResult ( "/" ) ;
121
153
Action a = ( ) => result . Should ( ) . BeViewResult ( ) ;
154
+
122
155
a . Should ( ) . Throw < Exception > ( )
123
156
. WithMessage ( "Expected ActionResult to be \" ViewResult\" , but found \" RedirectResult\" " ) ;
124
157
}
@@ -127,6 +160,7 @@ public void BeView_GivenNotView_ShouldFail()
127
160
public void BeStatusCodeResult_GivenStatusCodeResult_ShouldPass ( )
128
161
{
129
162
ActionResult result = new StatusCodeResult ( 200 ) ;
163
+
130
164
result . Should ( ) . BeStatusCodeResult ( ) ;
131
165
}
132
166
@@ -135,6 +169,7 @@ public void BeStatusCodeResult_GivenNotStatusCodeResult_ShouldFail()
135
169
{
136
170
ActionResult result = new RedirectResult ( "/" ) ;
137
171
Action a = ( ) => result . Should ( ) . BeStatusCodeResult ( ) ;
172
+
138
173
a . Should ( ) . Throw < Exception > ( )
139
174
. WithMessage ( "Expected ActionResult to be \" StatusCodeResult\" , but found \" RedirectResult\" " ) ;
140
175
}
0 commit comments