11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4- using dotnet . Tests ;
4+ using Microsoft . DotNet . Tools . Common ;
55using CommandResult = Microsoft . DotNet . Cli . Utils . CommandResult ;
66
77namespace Microsoft . DotNet . Cli . Test . Tests
@@ -12,8 +12,8 @@ public GivenDotnetTestBuildsAndRunsHelp(ITestOutputHelper log) : base(log)
1212 {
1313 }
1414
15- [ InlineData ( Constants . Debug ) ]
16- [ InlineData ( Constants . Release ) ]
15+ [ InlineData ( TestingConstants . Debug ) ]
16+ [ InlineData ( TestingConstants . Release ) ]
1717 [ Theory ]
1818 public void RunHelpOnTestProject_ShouldReturnZeroAsExitCode ( string configuration )
1919 {
@@ -26,20 +26,21 @@ public void RunHelpOnTestProject_ShouldReturnZeroAsExitCode(string configuration
2626
2727 if ( ! TestContext . IsLocalized ( ) )
2828 {
29- Assert . Matches ( @"Extension options :\s+--[\s\S]*" , result . StdOut ) ;
29+ Assert . Matches ( @"Extension Options :\s+--[\s\S]*" , result . StdOut ) ;
3030 Assert . Matches ( @"Options:\s+--[\s\S]*" , result . StdOut ) ;
3131 }
3232
3333 result . ExitCode . Should ( ) . Be ( ExitCodes . Success ) ;
3434 }
3535
36- [ InlineData ( Constants . Debug ) ]
37- [ InlineData ( Constants . Release ) ]
36+ [ InlineData ( TestingConstants . Debug ) ]
37+ [ InlineData ( TestingConstants . Release ) ]
3838 [ Theory ]
3939 public void RunHelpOnMultipleTestProjects_ShouldReturnZeroAsExitCode ( string configuration )
4040 {
4141 TestAsset testInstance = _testAssetsManager . CopyTestAsset ( "ProjectSolutionForMultipleTFMs" , Guid . NewGuid ( ) . ToString ( ) )
4242 . WithSource ( ) ;
43+ testInstance . WithTargetFramework ( $ "{ DotnetVersionHelper . GetPreviousDotnetVersion ( ) } ", "TestProject" ) ;
4344
4445 CommandResult result = new DotnetTestCommand ( Log , disableNewOutput : false )
4546 . WithWorkingDirectory ( testInstance . Path )
@@ -48,13 +49,13 @@ public void RunHelpOnMultipleTestProjects_ShouldReturnZeroAsExitCode(string conf
4849
4950 if ( ! TestContext . IsLocalized ( ) )
5051 {
51- Assert . Matches ( @"Extension options :\s+--[\s\S]*" , result . StdOut ) ;
52+ Assert . Matches ( @"Extension Options :\s+--[\s\S]*" , result . StdOut ) ;
5253 Assert . Matches ( @"Options:\s+--[\s\S]*" , result . StdOut ) ;
5354
54- string net9ProjectDllRegex = @"\s+.*\\net9\.0\\TestProjectWithNet9\.dll.*\s+--report-trx\s+--report-trx-filename" ;
55- string net48ProjectExeRegex = @" \s+.*\\net4\.8\\TestProjectWithNetFramework\.exe .*\s+--report-trx\s+--report-trx-filename" ;
55+ string directorySeparator = PathUtility . GetDirectorySeparatorChar ( ) ;
56+ 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) ";
5657
57- Assert . Matches ( @$ "Unavailable extension options:(?:( { net9ProjectDllRegex } )|( { net48ProjectExeRegex } ))(?:( { net48ProjectExeRegex } )|( { net9ProjectDllRegex } ))" , result . StdOut ) ;
58+ Assert . Matches ( otherTestProjectPattern , result . StdOut ) ;
5859 }
5960
6061 result . ExitCode . Should ( ) . Be ( ExitCodes . Success ) ;
0 commit comments