diff --git a/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs b/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs index 40614b5a8a16..e93a8677174b 100644 --- a/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs +++ b/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs @@ -146,8 +146,6 @@ private static CliOption CreateBlameHangDumpOption() private static readonly CliCommand Command = ConstructCommand(); - - public static CliCommand GetCommand() { return Command; diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsHelp.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsHelp.cs index 774632f30ec3..be7b3ecdb08d 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsHelp.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsHelp.cs @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using dotnet.Tests; +using Microsoft.DotNet.Tools.Common; using CommandResult = Microsoft.DotNet.Cli.Utils.CommandResult; namespace Microsoft.DotNet.Cli.Test.Tests @@ -12,8 +12,8 @@ public GivenDotnetTestBuildsAndRunsHelp(ITestOutputHelper log) : base(log) { } - [InlineData(Constants.Debug)] - [InlineData(Constants.Release)] + [InlineData(TestingConstants.Debug)] + [InlineData(TestingConstants.Release)] [Theory] public void RunHelpOnTestProject_ShouldReturnZeroAsExitCode(string configuration) { @@ -26,20 +26,21 @@ public void RunHelpOnTestProject_ShouldReturnZeroAsExitCode(string configuration if (!TestContext.IsLocalized()) { - Assert.Matches(@"Extension options:\s+--[\s\S]*", result.StdOut); + Assert.Matches(@"Extension Options:\s+--[\s\S]*", result.StdOut); Assert.Matches(@"Options:\s+--[\s\S]*", result.StdOut); } result.ExitCode.Should().Be(ExitCodes.Success); } - [InlineData(Constants.Debug)] - [InlineData(Constants.Release)] + [InlineData(TestingConstants.Debug)] + [InlineData(TestingConstants.Release)] [Theory] public void RunHelpOnMultipleTestProjects_ShouldReturnZeroAsExitCode(string configuration) { TestAsset testInstance = _testAssetsManager.CopyTestAsset("ProjectSolutionForMultipleTFMs", Guid.NewGuid().ToString()) .WithSource(); + testInstance.WithTargetFramework($"{DotnetVersionHelper.GetPreviousDotnetVersion()}", "TestProject"); CommandResult result = new DotnetTestCommand(Log, disableNewOutput: false) .WithWorkingDirectory(testInstance.Path) @@ -48,13 +49,13 @@ public void RunHelpOnMultipleTestProjects_ShouldReturnZeroAsExitCode(string conf if (!TestContext.IsLocalized()) { - Assert.Matches(@"Extension options:\s+--[\s\S]*", result.StdOut); + Assert.Matches(@"Extension Options:\s+--[\s\S]*", result.StdOut); Assert.Matches(@"Options:\s+--[\s\S]*", result.StdOut); - string net9ProjectDllRegex = @"\s+.*\\net9\.0\\TestProjectWithNet9\.dll.*\s+--report-trx\s+--report-trx-filename"; - string net48ProjectExeRegex = @"\s+.*\\net4\.8\\TestProjectWithNetFramework\.exe.*\s+--report-trx\s+--report-trx-filename"; + string directorySeparator = PathUtility.GetDirectorySeparatorChar(); + string otherTestProjectPattern = @$"Unavailable extension options:\s+.*{directorySeparator}{ToolsetInfo.CurrentTargetFramework}{directorySeparator}OtherTestProject\.dll.*\s+(--report-trx\s+--report-trx-filename|--report-trx-filename\s+--report-trx)"; - Assert.Matches(@$"Unavailable extension options:(?:({net9ProjectDllRegex})|({net48ProjectExeRegex}))(?:({net48ProjectExeRegex})|({net9ProjectDllRegex}))", result.StdOut); + Assert.Matches(otherTestProjectPattern, result.StdOut); } result.ExitCode.Should().Be(ExitCodes.Success); diff --git a/test/dotnet.Tests/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index 97f27447873b..58062b2df585 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -56,7 +56,6 @@ -