@@ -16,30 +16,31 @@ internal sealed class TestResultComposer
1616 private readonly TestContext _testContext ;
1717 private readonly bool _useDedicatedTestResultsDirectory ;
1818 private readonly string _defaultRunDirectory ;
19- private readonly string _runDirectory ;
20- private readonly string _testDirectory ;
2119 private readonly string _expectedDirectory ;
2220 private readonly string _actualDirectory ;
2321 private readonly ICollection < string > _testRunFiles ;
2422 private readonly ICollection < string > _testFiles ;
2523
24+ public string RunDirectory { get ; }
25+ public string TestDirectory { get ; }
26+
2627 public TestResultComposer ( TestContext testContext , bool useDedicatedTestResultsDirectory )
2728 {
2829 this . _testContext = testContext ;
2930 this . _useDedicatedTestResultsDirectory = useDedicatedTestResultsDirectory ;
3031 this . _defaultRunDirectory = testContext . TestRunResultsDirectory ;
3132 string dedicatedRunDirectory = BuildDedicatedRunDirectory ( testContext ) ;
32- this . _runDirectory = this . _useDedicatedTestResultsDirectory ? dedicatedRunDirectory : this . _defaultRunDirectory ;
33- this . _testDirectory = Path . Combine ( this . _runDirectory , "TestResults" , testContext . TestName ) ;
34- this . _expectedDirectory = Path . Combine ( this . _runDirectory , ExpectedDirectoryName ) ;
35- this . _actualDirectory = Path . Combine ( this . _runDirectory , ActualDirectoryName ) ;
33+ this . RunDirectory = this . _useDedicatedTestResultsDirectory ? dedicatedRunDirectory : this . _defaultRunDirectory ;
34+ this . TestDirectory = Path . Combine ( this . RunDirectory , "TestResults" , testContext . TestName ) ;
35+ this . _expectedDirectory = Path . Combine ( this . RunDirectory , ExpectedDirectoryName ) ;
36+ this . _actualDirectory = Path . Combine ( this . RunDirectory , ActualDirectoryName ) ;
3637 this . _testRunFiles = new HashSet < string > ( ) ;
3738 this . _testFiles = new HashSet < string > ( ) ;
3839 }
3940
4041 public string AddFile ( string fileName )
4142 {
42- string path = Path . Combine ( this . _testDirectory , fileName ) ;
43+ string path = Path . Combine ( this . TestDirectory , fileName ) ;
4344 EnsureDirectory ( path ) ;
4445 this . RegisterFile ( path , scopeIsTestRun : false ) ;
4546 return path ;
@@ -92,7 +93,7 @@ string FormatContent(EventLogEntry entry)
9293 private void EnsureFileComparisonContent ( string directory , string extension , string content )
9394 {
9495 this . EnsureFileComparisonContent ( Path . Combine ( directory , $ "{ this . _testContext . TestName } .{ extension } ") , content ) ;
95- this . EnsureFileComparisonContent ( Path . Combine ( this . _testDirectory , $ "{ new DirectoryInfo ( directory ) . Name } .{ extension } ") , content ) ;
96+ this . EnsureFileComparisonContent ( Path . Combine ( this . TestDirectory , $ "{ new DirectoryInfo ( directory ) . Name } .{ extension } ") , content ) ;
9697 }
9798 private void EnsureFileComparisonContent ( string path , string content )
9899 {
@@ -128,7 +129,7 @@ private void RegisterFile(string path, bool scopeIsTestRun)
128129 private void EnsureWinMergeStarter ( )
129130 {
130131 const string fileName = "winmerge.bat" ;
131- string path = Path . Combine ( this . _runDirectory , fileName ) ;
132+ string path = Path . Combine ( this . RunDirectory , fileName ) ;
132133
133134 if ( ! this . ShouldRegisterTestRunFile ( path ) )
134135 return ;
@@ -153,12 +154,12 @@ private void ZipTestOutput()
153154 if ( ! files . Any ( ) )
154155 return;
155156
156- string path = Path. Combine( this . _testDirectory , $"{this._testContext.TestName}.zip" ) ;
157+ string path = Path. Combine( this . TestDirectory , $"{this._testContext.TestName}.zip" ) ;
157158 using ( ZipArchive archive = ZipFile. Open ( path , ZipArchiveMode . Create ) )
158159 {
159160 foreach ( string file in files)
160161 {
161- int relativePathIndex = this . _runDirectory . Length + 1 ;
162+ int relativePathIndex = this . RunDirectory . Length + 1 ;
162163 string relativePath = file. Substring( relativePathIndex , file . Length - relativePathIndex ) ;
163164 archive . CreateEntryFromFile ( file , relativePath ) ;
164165 }
@@ -180,7 +181,7 @@ private void CopyFiles(IEnumerable<string> files, string targetDirectory, bool i
180181 {
181182 foreach ( string file in files)
182183 {
183- string relativeFilePath = file. Substring ( this . _runDirectory . Length + 1 ) ;
184+ string relativeFilePath = file. Substring ( this . RunDirectory . Length + 1 ) ;
184185 string targetFilePath = Path. Combine ( targetDirectory , relativeFilePath ) ;
185186 EnsureDirectory( targetFilePath ) ;
186187
0 commit comments