Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task AbortWithCTRLPlusC_CancellingTests(string tfm)
testHostResult.AssertOutputMatchesRegex("Canceling the test session.*");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
private const string Sources = """
#file AbortMSTestAsset.csproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void TestMethod()
using TestAsset testAsset = await TestAsset.GenerateAssetAsync("TestForMSTEST0001", code);
DotnetMuxerResult result = await DotnetCli.RunAsync(
$"build {testAsset.TargetAssetPath}",
AcceptanceFixture.NuGetGlobalPackagesFolder.Path,
warnAsError: false,
cancellationToken: TestContext.CancellationToken);
if (isAdapterReferenced)
Expand Down Expand Up @@ -113,7 +112,6 @@ public void TestMethod()
using TestAsset testAsset = await TestAsset.GenerateAssetAsync("AnalyzersMetapackage", code);
DotnetMuxerResult result = await DotnetCli.RunAsync(
$"build {testAsset.TargetAssetPath}",
AcceptanceFixture.NuGetGlobalPackagesFolder.Path,
warnAsError: false,
cancellationToken: TestContext.CancellationToken);
result.AssertOutputContains("MSTEST0014");
Expand Down Expand Up @@ -153,7 +151,6 @@ public void TestMethod()
using TestAsset testAsset = await TestAsset.GenerateAssetAsync("AnalyzersTestFrameworkPackage", code);
DotnetMuxerResult result = await DotnetCli.RunAsync(
$"build {testAsset.TargetAssetPath}",
AcceptanceFixture.NuGetGlobalPackagesFolder.Path,
warnAsError: false,
cancellationToken: TestContext.CancellationToken);
result.AssertOutputContains("MSTEST0014");
Expand Down Expand Up @@ -196,7 +193,6 @@ public void TestMethod()
using TestAsset testAsset = await TestAsset.GenerateAssetAsync("Analyzers", code);
DotnetMuxerResult result = await DotnetCli.RunAsync(
$"build {testAsset.TargetAssetPath}",
AcceptanceFixture.NuGetGlobalPackagesFolder.Path,
environmentVariables: new()
{
["DOTNET_CLI_UI_LANGUAGE"] = "it-IT",
Expand Down Expand Up @@ -295,7 +291,7 @@ public async void TestMethod1()

private static async Task AssertAnalysisModeAsync(string mode, string[] contains, string[] doesNotContain, string targetAssetPath)
{
async Task<DotnetMuxerResult> BuildTaskAsync() => await DotnetCli.RunAsync($"build {targetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, warnAsError: false, retryCount: 0);
async Task<DotnetMuxerResult> BuildTaskAsync() => await DotnetCli.RunAsync($"build {targetAssetPath}", warnAsError: false, retryCount: 0);

string output;
if (mode is "Recommended" or "All")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task RunTests_With_VSTest(bool? disableAppDomain)
null => string.Empty,
};

DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath}{disableAppDomainCommand}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken);
DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath}{disableAppDomainCommand}", workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken);
Assert.AreEqual(0, compilationResult.ExitCode);

compilationResult.AssertOutputContains(@"Passed! - Failed: 0, Passed: 2, Skipped: 0, Total: 2");
Expand All @@ -45,7 +45,7 @@ public async Task DiscoverTests_With_VSTest(bool? disableAppDomain)
null => string.Empty,
};

DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath} --list-tests{disableAppDomainCommand}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken);
DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath} --list-tests{disableAppDomainCommand}", workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken);
Assert.AreEqual(0, compilationResult.ExitCode);
}

Expand Down Expand Up @@ -107,7 +107,7 @@ private static string GetTestDllPath(string assetPath, string targetFramework) =

public TestContext TestContext { get; set; }

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
private const string SingleTestSourceCode = """
#file AppDomainTests.csproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public async Task EnableAspireProperty_WhenUsingVSTest_AllowsToRunAspireTests()
: testHost.FullName + ".dll";
DotnetMuxerResult dotnetTestResult = await DotnetCli.RunAsync(
$"test {exeOrDllName}",
AcceptanceFixture.NuGetGlobalPackagesFolder.Path,
workingDirectory: AssetFixture.AspireProjectPath,
warnAsError: false,
suppressPreviewDotNetMessage: false,
Expand All @@ -39,7 +38,7 @@ public async Task EnableAspireProperty_WhenUsingVSTest_AllowsToRunAspireTests()
dotnetTestResult.AssertOutputContains("Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string AspireProjectName = "AspireProject";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ In AsmCleanup
""");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "AssemblyCleanupTests";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void Dispose()
public async Task InitializeAsync(CancellationToken cancellationToken)
{
VSSolution solution = CreateTestAsset();
DotnetMuxerResult result = await DotnetCli.RunAsync($"build {solution.SolutionFile} -c Release", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: cancellationToken);
DotnetMuxerResult result = await DotnetCli.RunAsync($"build {solution.SolutionFile} -c Release", cancellationToken: cancellationToken);
result.AssertExitCodeIs(0);

TestHost = TestHost.LocateFrom(solution.Projects.Skip(1).Single().FolderPath, TestProjectName, TargetFramework);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task RunningTests_DoesNotHitResourceRecursionIssueAndDoesNotCrashTh
testHostResult.AssertExitCodeIs(ExitCodes.Success);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public string TargetAssetPath => GetAssetPath(AssetName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public async Task WhenCancelingTestContextTokenInTestMethod_MessageIsAsExpected(
testHostResult.AssertOutputContains("Failed!");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "TestCancellation";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand All @@ -24,7 +24,7 @@ public async Task TestConfigJson_AndRunSettingsHasMstest_Throws(string tfm)
testHostResult.AssertStandardErrorContains("Both '.runsettings' and '.testconfig.json' files have been detected. Please select only one of these test configuration files.");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectNameWithMSTestRunSettings = "ConfigurationMSTestSettings";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand All @@ -24,7 +24,7 @@ public async Task TestConfigJson_AndRunSettingsHasMstestv2_Throws(string tfm)
testHostResult.AssertStandardErrorContains("Both '.runsettings' and '.testconfig.json' files have been detected. Please select only one of these test configuration files.");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectNameWithMSTestV2RunSettings = "ConfigurationMSTestV2Settings";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public async Task TestWithConfigFromCommandLineWithNonExistingFile()
testHostResult.AssertStandardErrorContains("dummyconfigfile_not_existing_file.json");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "ConfigurationSettings";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand All @@ -23,7 +23,7 @@ public async Task DuplicateTestMethodAttribute_ShouldFail(string tfm)
testHostResult.AssertOutputContainsSummary(failed: 1, passed: 1, skipped: 0);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string DuplicateTestMethodProjectName = "DuplicateTestMethodAttribute";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public async Task TestDataSourceFromAppConfig()

await DotnetCli.RunAsync(
$"build {generator.TargetAssetPath} -c Release",
AcceptanceFixture.NuGetGlobalPackagesFolder.Path,
retryCount: 0,
cancellationToken: TestContext.CancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task DeadlockCaseAssemblyCleanupWaitingOnTestMethod(string tfm)
testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "DeadlockTests";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task AssemblyIsLoadedOnceFromDeploymentDirectory(string runsettings
testHostResult.AssertExitCodeIs(ExitCodes.Success);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
private const string Sources = """
#file DeploymentItemTests.csproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task DotnetTest_Should_Execute_Tests(string tfm, BuildConfiguration
.PatchCodeWithReplace("$OutputType$", string.Empty)
.PatchCodeWithReplace("$Extra$", string.Empty));

DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test {generator.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: generator.TargetAssetPath, cancellationToken: TestContext.CancellationToken);
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");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand All @@ -23,7 +23,7 @@ public async Task DuplicateTestClassAttribute_ShouldFail(string tfm)
testHostResult.AssertStandardErrorContains("Only one attribute of type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute' is allowed, but multiple were found.");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string DuplicateTestClassProjectName = "DuplicateTestClassAttribute";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task DynamicDataTestWithParameterizedDataProviderMethod(string tfm)
testHostResult.AssertOutputContains("TestMethodSingleParameterIntArray called with: 9");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "DynamicDataMethodTests";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task DynamicDataAttributeGetDataShouldWorkWithoutAdapter()
testHostResult.AssertExitCodeIs(ExitCodes.Success);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
private const string Sources = """
#file FrameworkOnlyTests.csproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Cannot create an instance of T\[] because Type\.ContainsGenericParameters is tru
""", RegexOptions.Singleline);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public override IEnumerable<(string ID, string Name, string Code)> GetAssetsToGenerate()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public async Task Info_WhenMSTestExtensionRegistered_OutputInfoContentOfRegister
testHostResult.AssertOutputContains(output);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public string TargetAssetPath => GetAssetPath(AssetName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public async Task WhenSpecificDataSourceIsIgnoredViaIgnoreMessageProperty()
testHostResult.AssertOutputContainsSummary(failed: 0, passed: 10, skipped: 6);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "TestIgnore";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public async Task TestOutcomeShouldBeRespectedCorrectly(Lifecycle inconclusiveSt
testHostResult.AssertOutputContains("AssemblyCleanup called");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "TestInconclusive";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public async Task TestContextInstancesShouldNotLeak(string tfm)
testHostResult.AssertOutputContainsSummary(failed: 0, passed: 100, skipped: 0);
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "LeakTests";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand Down Expand Up @@ -26,7 +26,7 @@ public async Task LifecycleAttributesTaskThreading_WhenMainIsNotSTA_RunsettingsA
testHostResult.AssertOutputContains("Passed!");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "LifecycleAttributesTask";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand Down Expand Up @@ -26,7 +26,7 @@ public async Task LifecycleAttributesValueTaskThreading_WhenMainIsNotSTA_Runsett
testHostResult.AssertOutputContains("Passed!");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "LifecycleAttributesValueTask";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand Down Expand Up @@ -26,7 +26,7 @@ public async Task LifecycleAttributesVoidThreading_WhenMainIsNotSTA_RunsettingsA
testHostResult.AssertOutputContains("Passed!");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "LifecycleAttributesVoid";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ AssemblyCleanup called.
""");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "LifecycleTests";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// 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;
Expand Down Expand Up @@ -26,7 +26,7 @@ public async Task LifecycleAttributesTaskThreading_WhenMainIsNotSTA_RunsettingsA
testHostResult.AssertOutputContains("Passed!");
}

public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder)
public sealed class TestAssetFixture() : TestAssetFixtureBase()
{
public const string ProjectName = "LifecycleWithParallelAttributesTask";
public const string AssemblyName = "LifecycleAttributesTask";
Expand Down
Loading
Loading