@@ -22,11 +22,21 @@ public sealed class AggregatedConfigurationTests
2222 [ DataRow ( PlatformConfigurationConstants . PlatformResultDirectory ) ]
2323 [ DataRow ( PlatformConfigurationConstants . PlatformCurrentWorkingDirectory ) ]
2424 [ DataRow ( PlatformConfigurationConstants . PlatformTestHostWorkingDirectory ) ]
25- public void IndexerTest_DirectoryNotSetAndNoConfigurationProviders_DirectoryIsNull ( string key )
26- => Assert . IsNull ( new AggregatedConfiguration ( [ ] , _testApplicationModuleInfoMock . Object , _fileSystemMock . Object , new ( null , [ ] , [ ] ) ) [ key ] ) ;
25+ public void IndexerTest_DirectoryNotSetAndNoConfigurationProviders ( string key )
26+ {
27+ _testApplicationModuleInfoMock . Setup ( x => x . GetCurrentTestApplicationDirectory ( ) ) . Returns ( "TestAppDir" ) ;
28+ string ? expected = key switch
29+ {
30+ PlatformConfigurationConstants . PlatformResultDirectory => Path . Combine ( "TestAppDir" , "TestResults" ) ,
31+ PlatformConfigurationConstants . PlatformCurrentWorkingDirectory => "TestAppDir" ,
32+ PlatformConfigurationConstants . PlatformTestHostWorkingDirectory => null ,
33+ _ => throw ApplicationStateGuard . Unreachable ( ) ,
34+ } ;
35+
36+ Assert . AreEqual ( expected , new AggregatedConfiguration ( [ ] , _testApplicationModuleInfoMock . Object , _fileSystemMock . Object , new ( null , [ ] , [ ] ) ) [ key ] ) ;
37+ }
2738
2839 [ TestMethod ]
29- [ DataRow ( PlatformConfigurationConstants . PlatformResultDirectory ) ]
3040 [ DataRow ( PlatformConfigurationConstants . PlatformCurrentWorkingDirectory ) ]
3141 [ DataRow ( PlatformConfigurationConstants . PlatformTestHostWorkingDirectory ) ]
3242 public void IndexerTest_DirectoryNotSetButConfigurationProvidersPresent_DirectoryIsNull ( string key )
@@ -126,7 +136,7 @@ public async ValueTask CheckTestResultsDirectoryOverrideAndCreateItAsync_Results
126136 Mock < IFileLoggerProvider > mockFileLogger = new ( ) ;
127137 mockFileLogger . Setup ( x => x . CheckLogFolderAndMoveToTheNewIfNeededAsync ( It . IsAny < string > ( ) ) ) . Callback ( ( ) => { } ) ;
128138
129- AggregatedConfiguration aggregatedConfiguration = new ( [ ] , mockTestApplicationModuleInfo . Object , mockFileSystem . Object , new ( null , [ new CommandLineParseOption ( "results-directory" , [ ExpectedPath ] ) ] , [ ] ) ) ;
139+ AggregatedConfiguration aggregatedConfiguration = new ( [ ] , mockTestApplicationModuleInfo . Object , mockFileSystem . Object , new ( null , [ ] , [ ] ) ) ;
130140 await aggregatedConfiguration . CheckTestResultsDirectoryOverrideAndCreateItAsync ( mockFileLogger . Object ) ;
131141
132142 string expectedPath = "a" + Path . DirectorySeparatorChar + "b" + Path . DirectorySeparatorChar + "TestResults" ;
@@ -161,35 +171,3 @@ public bool TryGet(string key, out string? value)
161171 }
162172 }
163173}
164-
165- internal sealed class FakeCommandLineOptions : ICommandLineOptions
166- {
167- private readonly string _path ;
168- private readonly bool _bypass ;
169-
170- public FakeCommandLineOptions ( string path , bool bypass = false )
171- {
172- _path = path ;
173- _bypass = bypass ;
174- }
175-
176- public bool IsOptionSet ( string optionName ) => throw new NotImplementedException ( ) ;
177-
178- public bool TryGetOptionArgumentList ( string optionName , [ NotNullWhen ( true ) ] out string [ ] ? arguments )
179- {
180- arguments = null ;
181- if ( _bypass )
182- {
183- return false ;
184- }
185-
186- switch ( optionName )
187- {
188- case PlatformCommandLineProvider . ResultDirectoryOptionKey :
189- arguments = [ _path ] ;
190- return true ;
191- default :
192- return false ;
193- }
194- }
195- }
0 commit comments