|
3 | 3 |
|
4 | 4 | namespace Microsoft.AspNetCore.Analyzers.Http;
|
5 | 5 |
|
| 6 | +using System.Globalization; |
6 | 7 | using System.Threading.Tasks;
|
7 |
| -using Microsoft.AspNetCore.Http; |
8 |
| -using Microsoft.AspNetCore.Builder; |
9 | 8 | using Microsoft.AspNetCore.Analyzer.Testing;
|
10 |
| -using Microsoft.CodeAnalysis; |
11 |
| -using System.Globalization; |
12 |
| - |
13 |
| -public class sdfsdf |
14 |
| -{ |
15 |
| - public void sdfsdfss() |
16 |
| - { |
17 |
| - var webApp = WebApplication.Create(); |
18 |
| - webApp.MapGet("/", async (HttpContext context) => |
19 |
| - { |
20 |
| - await Task.Yield(); |
21 |
| - return "hello world"; |
22 |
| - }); |
23 |
| - webApp.MapGet("/", async (HttpContext context) => |
24 |
| - { |
25 |
| - return await context.Request.ReadFromJsonAsync<object>(); |
26 |
| - }); |
27 |
| - webApp.MapGet("/", (HttpContext context) => |
28 |
| - { |
29 |
| - return context.Request.ReadFromJsonAsync<object>().AsTask(); |
30 |
| - }); |
31 |
| - webApp.Use(next => |
32 |
| - { |
33 |
| - return new RequestDelegate((HttpContext context) => |
34 |
| - { |
35 |
| - next(context).Wait(); |
36 |
| - return Task.FromResult("hello world"); |
37 |
| - }); |
38 |
| - }); |
39 |
| - webApp.Use(async (HttpContext context, Func<Task> next) => |
40 |
| - { |
41 |
| - context.SetEndpoint(new Endpoint(c => { return Task.FromResult(""); }, EndpointMetadataCollection.Empty, "Test")); |
42 |
| - await next(); |
43 |
| - }); |
44 |
| - webApp.MapGet("/", (HttpContext context) => |
45 |
| - { |
46 |
| - if (Task.CompletedTask.IsCompleted) |
47 |
| - { |
48 |
| - return Task.CompletedTask; |
49 |
| - } |
50 |
| - return Task.FromResult("hello world"); |
51 |
| - }); |
52 |
| - } |
53 |
| -} |
54 | 9 |
|
55 | 10 | public class RequestDelegateReturnTypeAnalyzerTests
|
56 | 11 | {
|
|
0 commit comments