1
+ using System;
2
+ using System.Security.Claims;
3
+ using Microsoft.AspNetCore.Authentication;
4
+ using Microsoft.AspNetCore.Mvc;
5
+ using Microsoft.AspNetCore.Mvc.ModelBinding;
6
+ using Microsoft.Net.Http.Headers;
7
+
8
+ namespace FluentAssertions.AspNetCore.Mvc.Sample.Controllers
9
+ {
10
+ [Produces("application/json")]
11
+ [Route("api")]
12
+ public class ApiController : Controller
13
+ {
14
+ #region Accepted
15
+ [HttpGet]
16
+ public IActionResult GetAccepted()
17
+ {
18
+ return Accepted();
19
+ }
20
+
21
+ [HttpGet]
22
+ public IActionResult GetAccepted(Uri uri)
23
+ {
24
+ return Accepted(uri);
25
+ }
26
+
27
+ [HttpGet]
28
+ public IActionResult GetAccepted(Uri uri, object value)
29
+ {
30
+ return Accepted(uri, value);
31
+ }
32
+
33
+ [HttpGet]
34
+ public IActionResult GetAccepted(object value)
35
+ {
36
+ return Accepted(value);
37
+ }
38
+
39
+ [HttpGet]
40
+ public IActionResult GetAccepted(string uri)
41
+ {
42
+ return Accepted(uri);
43
+ }
44
+
45
+ #endregion
46
+
47
+ #region AcceptedAtAction
48
+ [HttpGet]
49
+ public IActionResult GetAcceptedAtAction(string actionName)
50
+ {
51
+ return AcceptedAtAction(actionName);
52
+ }
53
+
54
+ [HttpGet]
55
+ public IActionResult GetAcceptedAtAction(string actionName, object routeValues, object value)
56
+ {
57
+ return AcceptedAtAction(actionName, routeValues, value);
58
+ }
59
+
60
+ [HttpGet]
61
+ public IActionResult GetAcceptedAtAction(string actionName, object value)
62
+ {
63
+ return AcceptedAtAction(actionName, value);
64
+ }
65
+
66
+ [HttpGet]
67
+ public IActionResult GetAcceptedAtAction(string actionName, string controllerName)
68
+ {
69
+ return AcceptedAtAction(actionName, controllerName);
70
+ }
71
+
72
+ [HttpGet]
73
+ public IActionResult GetAcceptedAtAction(string actionName, string controllerName, object routeValues)
74
+ {
75
+ return AcceptedAtAction(actionName, controllerName, routeValues);
76
+ }
77
+ #endregion
78
+
79
+ #region AcceptedAtRoute
80
+ [HttpGet]
81
+ public IActionResult GetAcceptedAtRoute(string routeName)
82
+ {
83
+ return AcceptedAtRoute(routeName);
84
+ }
85
+
86
+ [HttpGet]
87
+ public IActionResult GetAcceptedAtRoute(string routeName, object routeValues)
88
+ {
89
+ return AcceptedAtRoute(routeName, routeValues);
90
+ }
91
+
92
+ [HttpGet]
93
+ public IActionResult GetAcceptedAtRoute(object routeValues, object value)
94
+ {
95
+ return AcceptedAtRoute(routeValues, value);
96
+ }
97
+
98
+ [HttpGet]
99
+ public IActionResult GetAcceptedAtRoute(object routeValues)
100
+ {
101
+ return AcceptedAtRoute(routeValues);
102
+ }
103
+
104
+ [HttpGet]
105
+ public IActionResult GetAcceptedAtRoute(string routeName, object routeValues, object value)
106
+ {
107
+ return AcceptedAtRoute(routeName, routeValues, value);
108
+ }
109
+ #endregion
110
+
111
+ #region Ok
112
+ [HttpGet]
113
+ public IActionResult GetOk()
114
+ {
115
+ return Ok();
116
+ }
117
+
118
+ public IActionResult GetOk(object value)
119
+ {
120
+ return Ok(value);
121
+ }
122
+ #endregion
123
+
124
+ #region BadRequest
125
+ [HttpGet]
126
+ public IActionResult GetBadRequest()
127
+ {
128
+ return BadRequest();
129
+ }
130
+
131
+ [HttpGet]
132
+ public IActionResult GetBadRequest(ModelStateDictionary modelState)
133
+ {
134
+ return BadRequest(modelState);
135
+ }
136
+
137
+ [HttpGet]
138
+ public IActionResult GetBadRequest(object error)
139
+ {
140
+ return BadRequest(error);
141
+ }
142
+
143
+ #endregion
144
+
145
+ #region Created
146
+ [HttpGet]
147
+ public IActionResult GetCreated(Uri uri, object value)
148
+ {
149
+ return Created(uri, value);
150
+ }
151
+
152
+ [HttpGet]
153
+ public IActionResult GetCreated(string uri, object value)
154
+ {
155
+ return Created(uri, value);
156
+ }
157
+ #endregion
158
+
159
+ #region CreatedAtAction
160
+ [HttpGet]
161
+ public IActionResult GetCreatedAtAction(string actionName, object routeValues, object value)
162
+ {
163
+ return CreatedAtAction(actionName, routeValues, value);
164
+ }
165
+
166
+ [HttpGet]
167
+ public IActionResult GetCreatedAtAction(string actionName, object value)
168
+ {
169
+ return CreatedAtAction(actionName, value);
170
+ }
171
+
172
+ [HttpGet]
173
+ public IActionResult GetCreatedAtAction(string actionName, string controllerName, object routeValues, object value)
174
+ {
175
+ return CreatedAtAction(actionName, controllerName, routeValues, value);
176
+ }
177
+ #endregion
178
+
179
+ #region CreatedAtRoute
180
+ [HttpGet]
181
+ public IActionResult GetCreatedAtRoute(string routeName, object value)
182
+ {
183
+ return CreatedAtRoute(routeName, value);
184
+ }
185
+
186
+ [HttpGet]
187
+ public IActionResult GetCreatedAtRoute(object routeValues, object value)
188
+ {
189
+ return CreatedAtRoute(routeValues, value);
190
+ }
191
+
192
+ [HttpGet]
193
+ public IActionResult GetCreatedAtRoute(string routeName, object routeValues, object value)
194
+ {
195
+ return CreatedAtRoute(routeName, routeValues, value);
196
+ }
197
+ #endregion
198
+
199
+ #region Challenge
200
+ [HttpGet]
201
+ public IActionResult GetChallenge()
202
+ {
203
+ return Challenge();
204
+ }
205
+
206
+ [HttpGet]
207
+ public IActionResult GetChallenge(AuthenticationProperties authenticationProperties)
208
+ {
209
+ return Challenge(authenticationProperties);
210
+ }
211
+
212
+ [HttpGet]
213
+ public IActionResult GetChallenge(string[] authenticationSchemes)
214
+ {
215
+ return Challenge(authenticationSchemes);
216
+ }
217
+
218
+ [HttpGet]
219
+ public IActionResult GetChallenge(AuthenticationProperties authenticationProperties, string[] authenticationSchemes)
220
+ {
221
+ return Challenge(authenticationProperties, authenticationSchemes);
222
+ }
223
+
224
+ #endregion
225
+
226
+ #region Forbid
227
+ [HttpGet]
228
+ public IActionResult GetForbid()
229
+ {
230
+ return Forbid();
231
+ }
232
+
233
+ [HttpGet]
234
+ public IActionResult GetForbid(AuthenticationProperties authenticationProperties)
235
+ {
236
+ return Forbid(authenticationProperties);
237
+ }
238
+
239
+ [HttpGet]
240
+ public IActionResult GetForbid(string[] authenticationSchemes)
241
+ {
242
+ return Forbid(authenticationSchemes);
243
+ }
244
+
245
+ [HttpGet]
246
+ public IActionResult GetForbid(AuthenticationProperties authenticationProperties, string[] authenticationSchemes)
247
+ {
248
+ return Forbid(authenticationProperties, authenticationSchemes);
249
+ }
250
+
251
+ #endregion
252
+
253
+ #region NoContent
254
+ [HttpGet]
255
+ public IActionResult GetNoContent()
256
+ {
257
+ return NoContent();
258
+ }
259
+
260
+ #endregion
261
+
262
+ #region NotFound
263
+ [HttpGet]
264
+ public IActionResult GetNotFound()
265
+ {
266
+ return NotFound();
267
+ }
268
+
269
+ public IActionResult GetNotFound(object value)
270
+ {
271
+ return NotFound(value);
272
+ }
273
+ #endregion
274
+
275
+ #region Unauthorized
276
+ [HttpGet]
277
+ public IActionResult GetUnauthorized()
278
+ {
279
+ return Unauthorized();
280
+ }
281
+
282
+ #endregion
283
+
284
+ #region SignIn
285
+ [HttpGet]
286
+ public IActionResult GetSignIn(ClaimsPrincipal claimsPrincipal, string authenticationScheme)
287
+ {
288
+ return SignIn(claimsPrincipal, authenticationScheme);
289
+ }
290
+
291
+ [HttpGet]
292
+ public IActionResult GetSignIn(ClaimsPrincipal claimsPrincipal, AuthenticationProperties authenticationProperties, string authenticationScheme)
293
+ {
294
+ return SignIn(claimsPrincipal, authenticationProperties, authenticationScheme);
295
+ }
296
+ #endregion
297
+
298
+ #region SignOut
299
+ [HttpGet]
300
+ public IActionResult GetSignOut()
301
+ {
302
+ return SignOut();
303
+ }
304
+
305
+ [HttpGet]
306
+ public IActionResult GetSignOut(string[] authenticationSchemes)
307
+ {
308
+ return SignOut(authenticationSchemes);
309
+ }
310
+
311
+ [HttpGet]
312
+ public IActionResult GetSignOut(AuthenticationProperties authenticationProperties, string[] authenticationSchemes)
313
+ {
314
+ return SignOut(authenticationProperties, authenticationSchemes);
315
+ }
316
+
317
+ #endregion
318
+
319
+ #region LocalRedirect
320
+ [HttpGet]
321
+ public IActionResult GetLocalRedirect(string localUrl)
322
+ {
323
+ return LocalRedirect(localUrl);
324
+ }
325
+ #endregion
326
+
327
+ #region LocalRedirectPermanent
328
+ [HttpGet]
329
+ public IActionResult GetLocalRedirectPermanent(string localUrl)
330
+ {
331
+ return LocalRedirectPermanent(localUrl);
332
+ }
333
+ #endregion
334
+
335
+ #region LocalRedirectPreserveMethod
336
+ [HttpGet]
337
+ public IActionResult GetLocalRedirectPreserveMethod(string localUrl)
338
+ {
339
+ return LocalRedirectPreserveMethod(localUrl);
340
+ }
341
+ #endregion
342
+
343
+ #region LocalRedirectPermanentPreserveMethod
344
+ [HttpGet]
345
+ public IActionResult GetLocalRedirectPermanentPreserveMethod(string localUrl)
346
+ {
347
+ return LocalRedirectPermanentPreserveMethod(localUrl);
348
+ }
349
+ #endregion
350
+
351
+ #region PhysicalFile
352
+ [HttpGet]
353
+ public IActionResult GetPhysicalFile(string physicalPath, string contentType)
354
+ {
355
+ return PhysicalFile(physicalPath, contentType);
356
+ }
357
+
358
+ [HttpGet]
359
+ public IActionResult GetPhysicalFile(string physicalPath, string contentType, string fileDownloadName)
360
+ {
361
+ return PhysicalFile(physicalPath, contentType, fileDownloadName);
362
+ }
363
+
364
+ [HttpGet]
365
+ public IActionResult GetPhysicalFile(string physicalPath, string contentType, DateTimeOffset? lastModified, EntityTagHeaderValue entityTag)
366
+ {
367
+ return PhysicalFile(physicalPath, contentType, lastModified, entityTag);
368
+ }
369
+
370
+ [HttpGet]
371
+ public IActionResult GetPhysicalFile(string physicalPath, string contentType, string fileDownloadName, DateTimeOffset? lastModified, EntityTagHeaderValue entityTag)
372
+ {
373
+ return PhysicalFile(physicalPath, contentType, fileDownloadName, lastModified, entityTag);
374
+ }
375
+ #endregion
376
+
377
+ #region VirtualFile
378
+ [HttpGet]
379
+ public IActionResult GetVirtualFileResult(string fileName, string contentType)
380
+ {
381
+ return new VirtualFileResult(fileName, contentType);
382
+ }
383
+
384
+ [HttpGet]
385
+ public IActionResult GetVirtualFileResult(string fileName, MediaTypeHeaderValue mediaTypeHeaderValue)
386
+ {
387
+ return new VirtualFileResult(fileName, mediaTypeHeaderValue);
388
+ }
389
+
390
+ #endregion
391
+ }
392
+ }
0 commit comments