Skip to content

Commit 2fece9d

Browse files
committed
C#: Add MSTEST test project and check that the call to vstest doesn't get the UseSharedCompilation=false flag forwarded.
1 parent 65e6515 commit 2fece9d

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace dotnet_test_mstest;
2+
3+
[TestClass]
4+
public class UnitTest1
5+
{
6+
[TestMethod]
7+
public void TestMethod1()
8+
{
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
global using Microsoft.VisualStudio.TestTools.UnitTesting;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
8+
<IsPackable>false</IsPackable>
9+
<OutputType>Exe</OutputType>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
14+
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
15+
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
16+
<PackageReference Include="coverlet.collector" Version="3.1.2" />
17+
</ItemGroup>
18+
19+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from create_database_utils import *
2+
from diagnostics_test_utils import *
3+
4+
# Implicitly build and then run tests.
5+
run_codeql_database_create(['dotnet test'], test_db="test-db", lang="csharp")
6+
check_diagnostics()
7+
8+
# Explicitly build and then run tests.
9+
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")
10+
check_diagnostics(test_db="test2-db")

0 commit comments

Comments
 (0)