@@ -92,9 +92,9 @@ public string TestCode
9292
9393 public SourceFileList TestSources { get ; }
9494
95- public List < ( string filename , string content ) > AdditionalFiles { get ; } = new List < ( string filename , string content ) > ( ) ;
95+ public SourceFileCollection AdditionalFiles { get ; } = new SourceFileCollection ( ) ;
9696
97- public List < ( string filename , string content ) > FixedAdditionalFiles { get ; } = new List < ( string filename , string content ) > ( ) ;
97+ public SourceFileCollection FixedAdditionalFiles { get ; } = new SourceFileCollection ( ) ;
9898
9999 public Dictionary < string , string > XmlReferences { get ; } = new Dictionary < string , string > ( ) ;
100100
@@ -150,14 +150,14 @@ public string BatchFixedCode
150150
151151 public List < Func < Solution , ProjectId , Solution > > SolutionTransforms { get ; } = new List < Func < Solution , ProjectId , Solution > > ( ) ;
152152
153- public List < Func < ( string filename , string content ) [ ] > > AdditionalFilesFactories { get ; } = new List < Func < ( string filename , string content ) [ ] > > ( ) ;
153+ public List < Func < IEnumerable < ( string filename , SourceText content ) > > > AdditionalFilesFactories { get ; } = new List < Func < IEnumerable < ( string filename , SourceText content ) > > > ( ) ;
154154
155155 public async Task RunAsync ( CancellationToken cancellationToken )
156156 {
157157 Assert . NotEmpty ( this . TestSources ) ;
158158
159159 var expected = this . ExpectedDiagnostics . ToArray ( ) ;
160- ( string filename , string content ) [ ] additionalFiles = this . AdditionalFiles . Concat ( this . AdditionalFilesFactories . SelectMany ( factory => factory ( ) ) ) . ToArray ( ) ;
160+ ( string filename , SourceText content ) [ ] additionalFiles = this . AdditionalFiles . Concat ( this . AdditionalFilesFactories . SelectMany ( factory => factory ( ) ) ) . ToArray ( ) ;
161161 await this . VerifyDiagnosticsAsync ( this . TestSources . ToArray ( ) , additionalFiles , expected , cancellationToken ) . ConfigureAwait ( false ) ;
162162 if ( this . HasFixableDiagnostics ( ) )
163163 {
@@ -254,7 +254,7 @@ private static bool IsSubjectToExclusion(DiagnosticResult result)
254254 /// is run on the sources.</param>
255255 /// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
256256 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
257- private async Task VerifyDiagnosticsAsync ( ( string filename , SourceText content ) [ ] sources , ( string filename , string content ) [ ] additionalFiles , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
257+ private async Task VerifyDiagnosticsAsync ( ( string filename , SourceText content ) [ ] sources , ( string filename , SourceText content ) [ ] additionalFiles , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
258258 {
259259 var analyzers = this . GetDiagnosticAnalyzers ( ) . ToImmutableArray ( ) ;
260260 VerifyDiagnosticResults ( await this . GetSortedDiagnosticsAsync ( sources , additionalFiles , analyzers , cancellationToken ) . ConfigureAwait ( false ) , analyzers , expected ) ;
@@ -351,7 +351,7 @@ private static Diagnostic[] SortDistinctDiagnostics(IEnumerable<Diagnostic> diag
351351 /// <param name="cancellationToken">The <see cref="CancellationToken"/> that the task will observe.</param>
352352 /// <returns>A collection of <see cref="Diagnostic"/>s that surfaced in the source code, sorted by
353353 /// <see cref="Diagnostic.Location"/>.</returns>
354- private Task < ImmutableArray < Diagnostic > > GetSortedDiagnosticsAsync ( ( string filename , SourceText content ) [ ] sources , ( string filename , string content ) [ ] additionalFiles , ImmutableArray < DiagnosticAnalyzer > analyzers , CancellationToken cancellationToken )
354+ private Task < ImmutableArray < Diagnostic > > GetSortedDiagnosticsAsync ( ( string filename , SourceText content ) [ ] sources , ( string filename , SourceText content ) [ ] additionalFiles , ImmutableArray < DiagnosticAnalyzer > analyzers , CancellationToken cancellationToken )
355355 {
356356 return GetSortedDiagnosticsFromDocumentsAsync ( analyzers , this . GetDocuments ( sources , additionalFiles ) , cancellationToken ) ;
357357 }
@@ -362,7 +362,7 @@ private Task<ImmutableArray<Diagnostic>> GetSortedDiagnosticsAsync((string filen
362362 /// </summary>
363363 /// <param name="sources">Classes in the form of strings.</param>
364364 /// <returns>A collection of <see cref="Document"/>s representing the sources.</returns>
365- private Document [ ] GetDocuments ( ( string filename , SourceText content ) [ ] sources , ( string filename , string content ) [ ] additionalFiles )
365+ private Document [ ] GetDocuments ( ( string filename , SourceText content ) [ ] sources , ( string filename , SourceText content ) [ ] additionalFiles )
366366 {
367367 if ( this . Language != LanguageNames . CSharp && this . Language != LanguageNames . VisualBasic )
368368 {
@@ -393,7 +393,7 @@ private Document[] GetDocuments((string filename, SourceText content)[] sources,
393393 /// <see cref="LanguageNames"/> class.</param>
394394 /// <returns>A <see cref="Project"/> created out of the <see cref="Document"/>s created from the source
395395 /// strings.</returns>
396- protected Project CreateProject ( ( string filename , SourceText content ) [ ] sources , ( string filename , string content ) [ ] additionalFiles , string language )
396+ protected Project CreateProject ( ( string filename , SourceText content ) [ ] sources , ( string filename , SourceText content ) [ ] additionalFiles , string language )
397397 {
398398 Project project = this . CreateProjectImpl ( sources , additionalFiles , language ) ;
399399 return this . ApplyCompilationOptions ( project ) ;
@@ -408,7 +408,7 @@ protected Project CreateProject((string filename, SourceText content)[] sources,
408408 /// <see cref="LanguageNames"/> class.</param>
409409 /// <returns>A <see cref="Project"/> created out of the <see cref="Document"/>s created from the source
410410 /// strings.</returns>
411- protected virtual Project CreateProjectImpl ( ( string filename , SourceText content ) [ ] sources , ( string filename , string content ) [ ] additionalFiles , string language )
411+ protected virtual Project CreateProjectImpl ( ( string filename , SourceText content ) [ ] sources , ( string filename , SourceText content ) [ ] additionalFiles , string language )
412412 {
413413 var projectId = ProjectId . CreateNewId ( debugName : TestProjectName ) ;
414414 var solution = this . CreateSolution ( projectId , language ) ;
@@ -849,9 +849,9 @@ private async Task VerifyFixInternalAsync(
849849 ImmutableArray < DiagnosticAnalyzer > analyzers ,
850850 ImmutableArray < CodeFixProvider > codeFixProviders ,
851851 ( string filename , SourceText content ) [ ] oldSources ,
852- ( string filename , string content ) [ ] additionalFiles ,
852+ ( string filename , SourceText content ) [ ] additionalFiles ,
853853 ( string filename , SourceText content ) [ ] newSources ,
854- ( string filename , string content ) [ ] fixedAdditionalFiles ,
854+ ( string filename , SourceText content ) [ ] fixedAdditionalFiles ,
855855 int numberOfIterations ,
856856 Func < ImmutableArray < DiagnosticAnalyzer > , ImmutableArray < CodeFixProvider > , int ? , Project , int , CancellationToken , Task < Project > > getFixedProject ,
857857 CancellationToken cancellationToken )
@@ -907,9 +907,9 @@ private async Task VerifyFixInternalAsync(
907907 for ( int i = 0 ; i < updatedAdditionalDocuments . Length ; i ++ )
908908 {
909909 var actual = await updatedAdditionalDocuments [ i ] . GetTextAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
910- Assert . Equal ( fixedAdditionalFiles [ i ] . content , actual . ToString ( ) ) ;
911- //// Assert.Equal(fixedAdditionalFiles[i].content.Encoding, actual.Encoding);
912- //// Assert.Equal(fixedAdditionalFiles[i].content.ChecksumAlgorithm, actual.ChecksumAlgorithm);
910+ Assert . Equal ( fixedAdditionalFiles [ i ] . content . ToString ( ) , actual . ToString ( ) ) ;
911+ Assert . Equal ( fixedAdditionalFiles [ i ] . content . Encoding , actual . Encoding ) ;
912+ Assert . Equal ( fixedAdditionalFiles [ i ] . content . ChecksumAlgorithm , actual . ChecksumAlgorithm ) ;
913913 Assert . Equal ( fixedAdditionalFiles [ i ] . filename , updatedAdditionalDocuments [ i ] . Name ) ;
914914 }
915915 }
@@ -919,11 +919,6 @@ private static bool HasAnyChange((string filename, SourceText content)[] oldSour
919919 return ! oldSources . SequenceEqual ( newSources , SourceFileEqualityComparer . Instance ) ;
920920 }
921921
922- private static bool HasAnyChange ( ( string filename , string content ) [ ] additionalFiles , ( string filename , string content ) [ ] fixedAdditionalFiles )
923- {
924- return ! additionalFiles . SequenceEqual ( fixedAdditionalFiles ) ;
925- }
926-
927922 private static async Task < Project > FixEachAnalyzerDiagnosticAsync ( ImmutableArray < DiagnosticAnalyzer > analyzers , ImmutableArray < CodeFixProvider > codeFixProviders , int ? codeFixIndex , Project project , int numberOfIterations , CancellationToken cancellationToken )
928923 {
929924 var codeFixProvider = codeFixProviders . Single ( ) ;
0 commit comments