@@ -86,6 +86,147 @@ public EmptyResult BeEmptyResult(string reason, params object[] reasonArgs)
86
86
return Subject as EmptyResult ;
87
87
}
88
88
89
+ /// <summary>
90
+ /// Asserts that the subject is an <see cref="FileResult"/>.
91
+ /// </summary>
92
+ public FileResultAssertions BeFileResult ( )
93
+ {
94
+ return BeFileResult ( string . Empty , null ) ;
95
+ }
96
+
97
+ /// <summary>
98
+ /// Asserts that the subject is an <see cref="FileResult"/>.
99
+ /// </summary>
100
+ /// <param name="reason">
101
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
102
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
103
+ /// </param>
104
+ /// <param name="reasonArgs">
105
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
106
+ /// </param>
107
+ public FileResultAssertions BeFileResult ( string reason , params object [ ] reasonArgs )
108
+ {
109
+ Execute . Assertion
110
+ . BecauseOf ( reason , reasonArgs )
111
+ . ForCondition ( Subject is FileResult )
112
+ . FailWith ( Constants . CommonFailMessage , typeof ( FileResult ) . Name , Subject . GetType ( ) . Name ) ;
113
+
114
+ return new FileResultAssertions ( Subject as FileResult ) ;
115
+ }
116
+
117
+ /// <summary>
118
+ /// Asserts that the subject is an <see cref="FileContentResult"/>.
119
+ /// </summary>
120
+ public FileContentResultAssertions BeFileContentResult ( )
121
+ {
122
+ return BeFileContentResult ( string . Empty , null ) ;
123
+ }
124
+
125
+ /// <summary>
126
+ /// Asserts that the subject is an <see cref="FileContentResult"/>.
127
+ /// </summary>
128
+ /// <param name="reason">
129
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
130
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
131
+ /// </param>
132
+ /// <param name="reasonArgs">
133
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
134
+ /// </param>
135
+ public FileContentResultAssertions BeFileContentResult ( string reason , params object [ ] reasonArgs )
136
+ {
137
+ Execute . Assertion
138
+ . BecauseOf ( reason , reasonArgs )
139
+ . ForCondition ( Subject is FileContentResult )
140
+ . FailWith ( Constants . CommonFailMessage , typeof ( FileContentResult ) . Name , Subject . GetType ( ) . Name ) ;
141
+
142
+ return new FileContentResultAssertions ( Subject as FileContentResult ) ;
143
+ }
144
+
145
+ /// <summary>
146
+ /// Asserts that the subject is an <see cref="FileStreamResult"/>.
147
+ /// </summary>
148
+ internal FileStreamResultAssertions BeFileStreamResult ( )
149
+ {
150
+ return BeFileStreamResult ( string . Empty , null ) ;
151
+
152
+ }
153
+
154
+ /// <summary>
155
+ /// Asserts that the subject is an <see cref="FileStreamResult"/>.
156
+ /// </summary>
157
+ /// <param name="reason">
158
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
159
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
160
+ /// </param>
161
+ /// <param name="reasonArgs">
162
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
163
+ /// </param>
164
+ internal FileStreamResultAssertions BeFileStreamResult ( string reason , params object [ ] reasonArgs )
165
+ {
166
+ Execute . Assertion
167
+ . BecauseOf ( reason , reasonArgs )
168
+ . ForCondition ( Subject is FileStreamResult )
169
+ . FailWith ( Constants . CommonFailMessage , typeof ( FileStreamResult ) . Name , Subject . GetType ( ) . Name ) ;
170
+
171
+ return new FileStreamResultAssertions ( Subject as FileStreamResult ) ;
172
+ }
173
+
174
+ /// <summary>
175
+ /// Asserts that the subject is an <see cref="PhysicalFileResult"/>.
176
+ /// </summary>
177
+ internal PhysicalFileResultAssertions BePhysicalFileResult ( )
178
+ {
179
+ return BePhysicalFileResult ( string . Empty , null ) ;
180
+ }
181
+
182
+ /// <summary>
183
+ /// Asserts that the subject is an <see cref="FileStreamResult"/>.
184
+ /// </summary>
185
+ /// <param name="reason">
186
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
187
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
188
+ /// </param>
189
+ /// <param name="reasonArgs">
190
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
191
+ /// </param>
192
+ internal PhysicalFileResultAssertions BePhysicalFileResult ( string reason , params object [ ] reasonArgs )
193
+ {
194
+ Execute . Assertion
195
+ . BecauseOf ( reason , reasonArgs )
196
+ . ForCondition ( Subject is PhysicalFileResult )
197
+ . FailWith ( Constants . CommonFailMessage , typeof ( PhysicalFileResult ) . Name , Subject . GetType ( ) . Name ) ;
198
+
199
+ return new PhysicalFileResultAssertions ( Subject as PhysicalFileResult ) ;
200
+ }
201
+
202
+ /// <summary>
203
+ /// Asserts that the subject is an <see cref="VirtualFileResult"/>.
204
+ /// </summary>
205
+ internal VirtualFileResultAssertions BeVirtualFileResult ( )
206
+ {
207
+ return BeVirtualFileResult ( string . Empty , null ) ;
208
+ }
209
+
210
+ /// <summary>
211
+ /// Asserts that the subject is an <see cref="VirtualFileResult"/>.
212
+ /// </summary>
213
+ /// <param name="reason">
214
+ /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
215
+ /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
216
+ /// </param>
217
+ /// <param name="reasonArgs">
218
+ /// Zero or more objects to format using the placeholders in <see cref="reason" />.
219
+ /// </param>
220
+ internal VirtualFileResultAssertions BeVirtualFileResult ( string reason , params object [ ] reasonArgs )
221
+ {
222
+ Execute . Assertion
223
+ . BecauseOf ( reason , reasonArgs )
224
+ . ForCondition ( Subject is VirtualFileResult )
225
+ . FailWith ( Constants . CommonFailMessage , typeof ( VirtualFileResult ) . Name , Subject . GetType ( ) . Name ) ;
226
+
227
+ return new VirtualFileResultAssertions ( Subject as VirtualFileResult ) ;
228
+ }
229
+
89
230
/// <summary>
90
231
/// Asserts that the subject is an <see cref="JsonResult"/>.
91
232
/// </summary>
0 commit comments