Skip to content

Commit 2c17dd2

Browse files
author
hugo-syn
committed
C#: move OData test types into test/resources/stubs
Per review feedback on #22384, keep the ODataActionParameters/Delta<T> stub implementations out of the test .cs file and store them in test/resources/stubs instead, following the pattern used by other frameworks (e.g. JsonNET, Aws). The test now loads the stub project via an options file and relies on no .dll files.
1 parent a44bfec commit 2c17dd2

5 files changed

Lines changed: 42 additions & 35 deletions

File tree

csharp/ql/test/library-tests/frameworks/OData/OData.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
1-
using System.Collections.Generic;
2-
3-
namespace Microsoft.AspNet.OData
4-
{
5-
public class ODataActionParameters : Dictionary<string, object>
6-
{
7-
}
8-
9-
public class Delta<TStructuralType> where TStructuralType : class
10-
{
11-
private TStructuralType instance;
12-
13-
public Delta() { instance = default(TStructuralType); }
14-
15-
public TStructuralType GetInstance() => instance;
16-
17-
public void Patch(TStructuralType original) { }
18-
19-
public void Put(TStructuralType original) { }
20-
21-
public void CopyChangedValues(TStructuralType original) { }
22-
23-
public void CopyUnchangedValues(TStructuralType original) { }
24-
}
25-
}
26-
271
namespace Test
282
{
293
using Microsoft.AspNet.OData;
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
| OData.cs:72:55:72:64 | parameters | OData.cs:75:18:75:23 | access to local variable entity |
2-
| OData.cs:72:55:72:64 | parameters | OData.cs:76:18:76:28 | access to property Name |
3-
| OData.cs:72:55:72:64 | parameters | OData.cs:77:18:77:31 | access to property Content |
4-
| OData.cs:72:55:72:64 | parameters | OData.cs:78:18:78:38 | access to property Owner |
5-
| OData.cs:72:55:72:64 | parameters | OData.cs:81:22:81:28 | access to property Owner |
6-
| OData.cs:85:55:85:64 | parameters | OData.cs:91:26:91:35 | access to property Label |
7-
| OData.cs:85:55:85:64 | parameters | OData.cs:98:22:98:34 | access to property Category |
8-
| OData.cs:102:39:102:43 | delta | OData.cs:105:18:105:30 | access to property Name |
9-
| OData.cs:108:45:108:49 | delta | OData.cs:111:18:111:23 | access to property Name |
1+
| OData.cs:46:55:46:64 | parameters | OData.cs:49:18:49:23 | access to local variable entity |
2+
| OData.cs:46:55:46:64 | parameters | OData.cs:50:18:50:28 | access to property Name |
3+
| OData.cs:46:55:46:64 | parameters | OData.cs:51:18:51:31 | access to property Content |
4+
| OData.cs:46:55:46:64 | parameters | OData.cs:52:18:52:38 | access to property Owner |
5+
| OData.cs:46:55:46:64 | parameters | OData.cs:55:22:55:28 | access to property Owner |
6+
| OData.cs:59:55:59:64 | parameters | OData.cs:65:26:65:35 | access to property Label |
7+
| OData.cs:59:55:59:64 | parameters | OData.cs:72:22:72:34 | access to property Category |
8+
| OData.cs:76:39:76:43 | delta | OData.cs:79:18:79:30 | access to property Name |
9+
| OData.cs:82:45:82:49 | delta | OData.cs:85:18:85:23 | access to property Name |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/Microsoft.AspNet.OData/7.7.5/Microsoft.AspNet.OData.csproj
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// This file contains auto-generated code.
2+
// Generated from `Microsoft.AspNet.OData, Version=7.7.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35`.
3+
namespace Microsoft.AspNet.OData
4+
{
5+
public class ODataActionParameters : System.Collections.Generic.Dictionary<string, object>
6+
{
7+
public ODataActionParameters() => throw null;
8+
}
9+
10+
public class Delta<TStructuralType> where TStructuralType : class
11+
{
12+
public Delta() => throw null;
13+
public TStructuralType GetInstance() => throw null;
14+
public void Patch(TStructuralType original) => throw null;
15+
public void Put(TStructuralType original) => throw null;
16+
public void CopyChangedValues(TStructuralType original) => throw null;
17+
public void CopyUnchangedValues(TStructuralType original) => throw null;
18+
}
19+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net10.0</TargetFramework>
4+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
5+
<OutputPath>bin\</OutputPath>
6+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="../../_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj" />
11+
</ItemGroup>
12+
</Project>

0 commit comments

Comments
 (0)