C#: Update test cases that depends on System.Data.cs to use generated stubs.

This commit is contained in:
Michael Nebel
2023-12-19 11:36:13 +01:00
parent 7cb758a61b
commit 19a4cf3a7b
5 changed files with 32 additions and 18 deletions

View File

@@ -1,2 +1,3 @@
semmle-extractor-options: /r:System.Data.dll /r:System.ComponentModel.Primitives.dll /r:System.ComponentModel.TypeConverter.dll ${testdir}/../../../resources/stubs/EntityFramework.cs ${testdir}/../../../resources/stubs/System.Data.cs /r:System.ComponentModel.TypeConverter.dll /r:System.Data.Common.dll /r:System.Linq.dll
semmle-extractor-options: ${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/System.ComponentModel.Annotations.cs ${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/System.ComponentModel.cs
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
semmle-extractor-options: ${testdir}/../../../resources/stubs/EntityFramework.cs

View File

@@ -1,10 +1,10 @@
sqlExpressions
| sql.cs:44:23:44:44 | object creation of type MySqlCommand | sql.cs:44:40:44:43 | access to parameter text |
| sql.cs:45:13:45:38 | ... = ... | sql.cs:45:35:45:38 | access to parameter text |
| sql.cs:46:13:46:34 | object creation of type MySqlCommand | sql.cs:46:30:46:33 | access to parameter text |
| sql.cs:46:13:46:53 | ... = ... | sql.cs:46:50:46:53 | access to parameter text |
| sql.cs:54:23:54:44 | object creation of type MySqlCommand | sql.cs:54:40:54:43 | access to parameter text |
| sql.cs:55:13:55:38 | ... = ... | sql.cs:55:35:55:38 | access to parameter text |
| sql.cs:56:13:56:34 | object creation of type MySqlCommand | sql.cs:56:30:56:33 | access to parameter text |
| sql.cs:56:13:56:53 | ... = ... | sql.cs:56:50:56:53 | access to parameter text |
sqlCsvSinks
| sql.cs:43:46:43:65 | object creation of type SqlCommand | sql.cs:43:61:43:64 | access to parameter text |
| sql.cs:47:13:47:42 | object creation of type SqlDataAdapter | sql.cs:47:32:47:35 | access to parameter text |
| sql.cs:48:13:48:47 | call to method ExecuteScalar | sql.cs:48:43:48:46 | access to parameter text |
| sql.cs:49:13:49:75 | call to method ExecuteScalar | sql.cs:49:71:49:74 | access to parameter text |
| sql.cs:53:46:53:65 | object creation of type SqlCommand | sql.cs:53:61:53:64 | access to parameter text |
| sql.cs:57:13:57:50 | object creation of type SqlDataAdapter | sql.cs:57:32:57:35 | access to parameter text |
| sql.cs:58:13:58:47 | call to method ExecuteScalar | sql.cs:58:43:58:46 | access to parameter text |
| sql.cs:59:13:59:75 | call to method ExecuteScalar | sql.cs:59:71:59:74 | access to parameter text |

View File

@@ -1,3 +1,3 @@
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Data.cs
semmle-extractor-options: ${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/System.ComponentModel.cs
semmle-extractor-options: /r:System.ComponentModel.TypeConverter.dll /r:System.Data.Common.dll
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/System.Data.SqlClient/4.8.5/System.Data.SqlClient.csproj

View File

@@ -8,11 +8,21 @@ namespace MySql.Data.MySqlClient
{
public MySqlCommand(string commandText) { }
public void Cancel() => throw null;
public string CommandText { get; set; }
public IDataReader ExecuteReader() => throw null;
public int CommandTimeout { get; set; }
public CommandType CommandType { get; set; }
public IDataParameterCollection Parameters { get; set; }
public IDbConnection Connection { get; set; }
public IDbDataParameter CreateParameter() => throw null;
public int ExecuteNonQuery() => throw null;
public IDataReader ExecuteReader() => throw null;
public IDataReader ExecuteReader(CommandBehavior behavior) => throw null;
public object ExecuteScalar() => throw null;
public IDataParameterCollection Parameters { get; }
public void Prepare() => throw null;
public IDbTransaction Transaction { get; set; }
public UpdateRowSource UpdatedRowSource { get; set; }
public void Dispose() => throw null;
}
public class MySqlHelper
@@ -44,7 +54,7 @@ namespace SqlClientTests
command = new MySqlCommand(text);
command.CommandText = text;
new MySqlCommand(text).CommandText = text;
new SqlDataAdapter(text, null);
new SqlDataAdapter(text, string.Empty);
MySqlHelper.ExecuteScalar("", text);
SqlHelper.ExecuteScalar("", System.Data.CommandType.Text, text);
}

View File

@@ -1 +1,4 @@
semmle-extractor-options: /r:System.Data.dll /r:System.ComponentModel.Primitives.dll /r:System.ComponentModel.TypeConverter.dll ${testdir}/../../../../resources/stubs/EntityFramework.cs ${testdir}/../../../../resources/stubs/System.Data.cs /r:System.ComponentModel.TypeConverter.dll /r:System.Data.Common.dll
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../../resources/stubs/System.Data.OleDb/8.0.0/System.Data.OleDb.csproj
semmle-extractor-options: ${testdir}/../../../../resources/stubs/EntityFramework.cs