Add project samples for MSTest.Sdk (#2675)

This commit is contained in:
Amaury Levé 2024-04-08 12:15:54 +02:00 коммит произвёл GitHub
Родитель 1da2810628
Коммит c748ee1f24
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
13 изменённых файлов: 217 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.34807.42
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectUsingVSTest", "ProjectUsingVSTest\ProjectUsingVSTest.csproj", "{0360A072-0ED6-4A27-9AE5-3C6DD055733E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectUsingMSTestRunner", "ProjectUsingMSTestRunner\ProjectUsingMSTestRunner.csproj", "{8DA3F43B-938F-4A1E-BE58-B7F80386187F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectWithNativeAOT", "ProjectWithNativeAOT\ProjectWithNativeAOT.csproj", "{9EA03738-C4AA-4CD7-BF71-BA8E689522D7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0360A072-0ED6-4A27-9AE5-3C6DD055733E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0360A072-0ED6-4A27-9AE5-3C6DD055733E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0360A072-0ED6-4A27-9AE5-3C6DD055733E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0360A072-0ED6-4A27-9AE5-3C6DD055733E}.Release|Any CPU.Build.0 = Release|Any CPU
{8DA3F43B-938F-4A1E-BE58-B7F80386187F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8DA3F43B-938F-4A1E-BE58-B7F80386187F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DA3F43B-938F-4A1E-BE58-B7F80386187F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8DA3F43B-938F-4A1E-BE58-B7F80386187F}.Release|Any CPU.Build.0 = Release|Any CPU
{9EA03738-C4AA-4CD7-BF71-BA8E689522D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9EA03738-C4AA-4CD7-BF71-BA8E689522D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EA03738-C4AA-4CD7-BF71-BA8E689522D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EA03738-C4AA-4CD7-BF71-BA8E689522D7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {04BEDCF3-1E4B-4C1E-8432-2221740A1A14}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,2 @@
<Project>
</Project>

Просмотреть файл

@ -0,0 +1,2 @@
<Project>
</Project>

Просмотреть файл

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<!--
By default, nuget feed is deactivated for security reasons, instead we use our validated mirror.
But you can still use the nuget feed by uncommenting the line below.
-->
<!-- <add key="nuget" value="https://api.nuget.org/v3/index.json" /> -->
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
</packageSources>
</configuration>

Просмотреть файл

@ -0,0 +1,39 @@
<Project Sdk="MSTest.Sdk/3.3.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<!-- By default, MSTest Sdk uses MSTest runner -->
</PropertyGroup>
</Project>
<!--
Below is the equivalent project configuration when not using MSTest.Sdk
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<EnableMSTestRunner>true</EnableMSTestRunner>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.4" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.1.0" />
<PackageReference Include="MSTest.Analyzers" Version="3.3.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
</ItemGroup>
</Project>
-->

Просмотреть файл

@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace ProjectUsingMSTestRunner;
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}

Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
global using Microsoft.VisualStudio.TestTools.UnitTesting;

Просмотреть файл

@ -0,0 +1,33 @@
<Project Sdk="MSTest.Sdk/3.3.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<!-- Use VSTest as runner/platform (this is not the default). This is changing the included packages and default configuration. -->
<UseVSTest>true</UseVSTest>
</PropertyGroup>
</Project>
<!--
Below is the equivalent project configuration when not using MSTest.Sdk
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSTest" Version="3.3.1" />
</ItemGroup>
</Project>
-->

Просмотреть файл

@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace ProjectUsingVSTest;
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}

Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
global using Microsoft.VisualStudio.TestTools.UnitTesting;

Просмотреть файл

@ -0,0 +1,41 @@
<Project Sdk="MSTest.Sdk/3.3.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<!-- When MSTest Sdk detects PublishAot=true, it references the required packages to ensure Native AOT support -->
<PublishAot>true</PublishAot>
</PropertyGroup>
</Project>
<!--
Below is the equivalent project configuration when not using MSTest.Sdk
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<OutputType>exe</OutputType>
<PublishAot>true</PublishAot>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Version="17.10.4" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.4" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.1.0" />
<PackageReference Include="Microsoft.Testing.Platform.MSBuild" Version="1.1.0" />
<PackageReference Include="MSTest.Engine" Version="1.0.0-alpha.24163.4" />
<PackageReference Include="MSTest.SourceGeneration" Version="1.0.0-alpha.24163.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
</ItemGroup>
</Project>
-->

Просмотреть файл

@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace ProjectWithNativeAOT;
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}

Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
global using Microsoft.VisualStudio.TestTools.UnitTesting;