@@ -544,10 +544,9 @@ private static string TrimChecksum(string text)
544544
545545 public static void VerifyIncrementalSteps ( this GeneratorRunResult result , string stepName , params IncrementalStepRunReason [ ] expectedReasons )
546546 {
547- var trackedSteps = result . TrackedSteps ;
548- Assert . True ( trackedSteps . ContainsKey ( stepName ) , $ "Expected step '{ stepName } ' not found. Available steps: { string . Join ( ", " , trackedSteps . Keys ) } ") ;
547+ VerifyStepExists ( result , stepName ) ;
549548
550- var steps = trackedSteps [ stepName ] ;
549+ var steps = result . TrackedSteps [ stepName ] ;
551550 Assert . Equal ( expectedReasons . Length , steps . Length ) ;
552551
553552 for ( int i = 0 ; i < expectedReasons . Length ; i ++ )
@@ -560,10 +559,9 @@ public static void VerifyIncrementalSteps(this GeneratorRunResult result, string
560559
561560 public static void VerifyIncrementalStepsMultiple ( this GeneratorRunResult result , string stepName , params IncrementalStepRunReason [ ] expectedReasons )
562561 {
563- var trackedSteps = result . TrackedSteps ;
564- Assert . True ( trackedSteps . ContainsKey ( stepName ) , $ "Expected step '{ stepName } ' not found. Available steps: { string . Join ( ", " , trackedSteps . Keys ) } ") ;
562+ VerifyStepExists ( result , stepName ) ;
565563
566- var steps = trackedSteps [ stepName ] ;
564+ var steps = result . TrackedSteps [ stepName ] ;
567565
568566 var actualReasons = steps . SelectMany ( step => step . Outputs . Select ( output => output . Reason ) ) . ToArray ( ) ;
569567 Assert . Equal ( expectedReasons . Length , actualReasons . Length ) ;
@@ -573,4 +571,18 @@ public static void VerifyIncrementalStepsMultiple(this GeneratorRunResult result
573571 Assert . Equal ( expectedReasons [ i ] , actualReasons [ i ] ) ;
574572 }
575573 }
574+
575+ private static void VerifyStepExists ( GeneratorRunResult result , string stepName )
576+ {
577+ var trackedSteps = result . TrackedSteps ;
578+ if ( ! trackedSteps . ContainsKey ( stepName ) )
579+ {
580+ var availableSteps = string . Join ( ", " , trackedSteps . Keys . OrderBy ( k => k ) . Take ( 10 ) ) ;
581+ if ( trackedSteps . Count > 10 )
582+ {
583+ availableSteps += $ ", ... ({ trackedSteps . Count - 10 } more)";
584+ }
585+ Assert . Fail ( $ "Expected step '{ stepName } ' not found. Available steps: { availableSteps } ") ;
586+ }
587+ }
576588}
0 commit comments