Skip to content

Commit d2c5266

Browse files
committed
C#: Add more test examples.
1 parent aaf14b0 commit d2c5266

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

csharp/ql/test/library-tests/dataflow/flowsources/aspremote/AspRemoteFlowSource.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.AspNetCore.Builder;
22
using Microsoft.AspNetCore.Mvc;
3+
using System;
34

45
namespace Testing
56
{
@@ -24,15 +25,24 @@ public object MyAction(ViewModel viewModel)
2425

2526
public class AspRoutingEndpoints
2627
{
28+
public delegate void MapGetHandler(string delegateparam);
29+
30+
public void HandlerMethod(string param) { }
31+
2732
public void M1(string[] args)
2833
{
2934
var builder = WebApplication.CreateBuilder(args);
3035
var app = builder.Build();
3136

3237
// The delegate parameters are considered flow sources.
3338
app.MapGet("/api/redirect/{newUrl}", (string newUrl) => { });
34-
app.MapGet("/{myApi}/redirect/{myUrl}", (string myApi, string myUrl) => { } );
39+
app.MapGet("/{myApi}/redirect/{myUrl}", (string myApi, string myUrl) => { });
40+
41+
Action<string> handler = (string lambdaParam) => { };
42+
app.MapGet("/api/redirect/{lambdaParam}", handler);
3543

44+
MapGetHandler handler2 = HandlerMethod;
45+
app.MapGet("/api/redirect/{param}", handler2);
3646
app.Run();
3747
}
3848
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
remoteFlowSourceMembers
2-
| AspRemoteFlowSource.cs:9:23:9:31 | RequestId |
2+
| AspRemoteFlowSource.cs:10:23:10:31 | RequestId |
33
remoteFlowSources
4-
| AspRemoteFlowSource.cs:19:42:19:50 | viewModel |
5-
| AspRemoteFlowSource.cs:33:58:33:63 | newUrl |
6-
| AspRemoteFlowSource.cs:34:61:34:65 | myApi |
7-
| AspRemoteFlowSource.cs:34:75:34:79 | myUrl |
4+
| AspRemoteFlowSource.cs:20:42:20:50 | viewModel |
5+
| AspRemoteFlowSource.cs:30:42:30:46 | param |
6+
| AspRemoteFlowSource.cs:38:58:38:63 | newUrl |
7+
| AspRemoteFlowSource.cs:39:61:39:65 | myApi |
8+
| AspRemoteFlowSource.cs:39:75:39:79 | myUrl |
9+
| AspRemoteFlowSource.cs:41:46:41:56 | lambdaParam |

0 commit comments

Comments
 (0)