From 2fece9d72148593f39a770c5660ddd1f93bb1c44 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Thu, 8 Jun 2023 09:58:52 +0200 Subject: [PATCH] C#: Add MSTEST test project and check that the call to vstest doesn't get the UseSharedCompilation=false flag forwarded. --- .../dotnet_test_mstest/UnitTest1.cs | 10 ++++++++++ .../posix-only/dotnet_test_mstest/Usings.cs | 1 + .../dotnet_test_mstest.csproj | 19 +++++++++++++++++++ .../posix-only/dotnet_test_mstest/test.py | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 csharp/ql/integration-tests/posix-only/dotnet_test_mstest/UnitTest1.cs create mode 100644 csharp/ql/integration-tests/posix-only/dotnet_test_mstest/Usings.cs create mode 100644 csharp/ql/integration-tests/posix-only/dotnet_test_mstest/dotnet_test_mstest.csproj create mode 100644 csharp/ql/integration-tests/posix-only/dotnet_test_mstest/test.py diff --git a/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/UnitTest1.cs b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/UnitTest1.cs new file mode 100644 index 00000000000..7e3b2ce1d1c --- /dev/null +++ b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/UnitTest1.cs @@ -0,0 +1,10 @@ +namespace dotnet_test_mstest; + +[TestClass] +public class UnitTest1 +{ + [TestMethod] + public void TestMethod1() + { + } +} diff --git a/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/Usings.cs b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/Usings.cs new file mode 100644 index 00000000000..540383dcf43 --- /dev/null +++ b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/Usings.cs @@ -0,0 +1 @@ +global using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/dotnet_test_mstest.csproj b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/dotnet_test_mstest.csproj new file mode 100644 index 00000000000..95c7586e04e --- /dev/null +++ b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/dotnet_test_mstest.csproj @@ -0,0 +1,19 @@ + + + + net7.0 + enable + enable + + false + Exe + + + + + + + + + + diff --git a/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/test.py b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/test.py new file mode 100644 index 00000000000..345d26a1516 --- /dev/null +++ b/csharp/ql/integration-tests/posix-only/dotnet_test_mstest/test.py @@ -0,0 +1,10 @@ +from create_database_utils import * +from diagnostics_test_utils import * + +# Implicitly build and then run tests. +run_codeql_database_create(['dotnet test'], test_db="test-db", lang="csharp") +check_diagnostics() + +# Explicitly build and then run tests. +run_codeql_database_create(['dotnet clean', 'rm -rf test-db', 'dotnet build -o myout --os win', 'dotnet test myout/dotnet_test_mstest.exe'], test_db="test2-db", lang="csharp") +check_diagnostics(test_db="test2-db")