@@ -10,18 +10,16 @@ namespace CodeOfChaos.Testing.TUnit.Conditions;
1010// Code
1111// ---------------------------------------------------------------------------------------------------------------------
1212public class GeneratorDriverRunResultHasSourceTextEqualToCondition ( string filename , string expected , StringComparison stringComparison , bool ignoreWhiteSpace , bool withTrimming )
13- : ExpectedValueAssertCondition < GeneratorDriverRunResult , string > ( expected ) {
14- private readonly string _expected = expected ;
13+ : BaseAssertCondition < GeneratorDriverRunResult > {
1514
1615 // -----------------------------------------------------------------------------------------------------------------
1716 // Methods
1817 // -----------------------------------------------------------------------------------------------------------------
1918 protected override string GetExpectation ( ) => throw new NotImplementedException ( ) ;
20- protected override async Task < AssertionResult > GetResult ( GeneratorDriverRunResult ? runResult , string ? expectedValue ) {
21- if ( runResult is null ) return AssertionResult . Fail ( "Compilation is null" ) ;
22- if ( expectedValue is null ) return AssertionResult . Fail ( "Expected string is null" ) ;
19+ protected override async Task < AssertionResult > GetResult ( GeneratorDriverRunResult ? actualValue , Exception ? exception , AssertionMetadata assertionMetadata ) {
20+ if ( actualValue is null ) return AssertionResult . Fail ( "Compilation is null" ) ;
2321
24- GeneratedSourceResult ? generatedSource = runResult . Results
22+ GeneratedSourceResult ? generatedSource = actualValue . Results
2523 . SelectMany ( result => result . GeneratedSources )
2624 . SingleOrDefault ( result => result . HintName == filename ) ;
2725
@@ -32,10 +30,10 @@ protected override async Task<AssertionResult> GetResult(GeneratorDriverRunResul
3230 string sourceTextString = sourceText . ToString ( ) ;
3331
3432 // Use the TUnit Equals String so it follows the same structure
35- var stringEqualsAssertCondition = new StringEqualsExpectedValueAssertCondition ( _expected , stringComparison ) ;
33+ var stringEqualsAssertCondition = new StringEqualsExpectedValueAssertCondition ( expected , stringComparison ) ;
3634 if ( withTrimming ) stringEqualsAssertCondition . WithTrimming ( ) ;
3735 if ( ignoreWhiteSpace ) stringEqualsAssertCondition . IgnoringWhitespace ( ) ;
3836
39- return await stringEqualsAssertCondition . GetAssertionResult ( sourceTextString , null ) ;
37+ return await stringEqualsAssertCondition . GetAssertionResult ( sourceTextString , null , assertionMetadata ) ;
4038 }
4139}
0 commit comments