-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathDotnetTestCliTests.cs
More file actions
35 lines (28 loc) · 1.79 KB
/
DotnetTestCliTests.cs
File metadata and controls
35 lines (28 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Testing.Platform.Acceptance.IntegrationTests;
using Microsoft.Testing.Platform.Acceptance.IntegrationTests.Helpers;
namespace MSTest.Acceptance.IntegrationTests;
[TestClass]
public class DotnetTestCliTests : AcceptanceTestBase<NopAssetFixture>
{
private const string AssetName = "MSTestProject";
[TestMethod]
[DynamicData(nameof(GetBuildMatrixTfmBuildConfiguration), typeof(AcceptanceTestBase<NopAssetFixture>))]
public async Task DotnetTest_Should_Execute_Tests(string tfm, BuildConfiguration buildConfiguration)
{
using TestAsset generator = await TestAsset.GenerateAssetAsync(
AssetName,
CurrentMSTestSourceCode
.PatchCodeWithReplace("$TargetFramework$", $"<TargetFramework>{tfm}</TargetFramework>")
.PatchCodeWithReplace("$MicrosoftNETTestSdkVersion$", MicrosoftNETTestSdkVersion)
.PatchCodeWithReplace("$MSTestVersion$", MSTestVersion)
.PatchCodeWithReplace("$EnableMSTestRunner$", string.Empty)
.PatchCodeWithReplace("$OutputType$", string.Empty)
.PatchCodeWithReplace("$Extra$", string.Empty));
DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test {generator.TargetAssetPath}", workingDirectory: generator.TargetAssetPath, cancellationToken: TestContext.CancellationToken);
// There is whitespace difference in output in parent and public repo that depends on the version of the dotnet SDK used.
compilationResult.AssertOutputMatchesRegex(@"Passed!\s+-\s+Failed:\s+0,\s+Passed:\s+1,\s+Skipped:\s+0,\s+Total:\s+1");
}
public TestContext TestContext { get; set; }
}