@@ -22,18 +22,18 @@ public async Task Execute()
2222
2323 var issues = new StringBuilder ( ) ;
2424
25- void ValidateAssertions ( IEnumerable < ExpressionStatementSyntax > oldAssertions , ExpressionStatementSyntax newAssertion , MethodDeclarationSyntax method , string className )
25+ void ValidateAssertions ( IEnumerable < ExpressionStatementSyntax > oldAssertions , ExpressionStatementSyntax newAssertion , MethodDeclarationSyntax method )
2626 {
2727 foreach ( var oldAssertion in oldAssertions )
2828 {
2929 if ( ! oldAssertion . WithoutTrivia ( ) . IsEquivalentTo ( newAssertion . WithoutTrivia ( ) ) )
3030 {
31- issues . AppendLine ( $ "[{ className } ] { method . Identifier } - actual: { oldAssertion . ToFullString ( ) } expected: { newAssertion . ToFullString ( ) } ") ;
31+ issues . AppendLine ( $ "[{ TestFile . Split ( ' \\ ' ) [ ^ 1 ] } ] { method . Identifier } - actual: { oldAssertion . ToFullString ( ) } expected: { newAssertion . ToFullString ( ) } ") ;
3232 }
3333 }
3434 }
3535
36- Console . WriteLine ( $ "File: { Path . GetFileName ( tree . FilePath ) } ") ;
36+ Console . WriteLine ( $ "File: { Path . GetFileName ( TestFile ) } ") ;
3737
3838 var root = await tree . GetRootAsync ( ) ;
3939 var methods = root . DescendantNodes ( ) . OfType < MethodDeclarationSyntax > ( ) ;
@@ -45,22 +45,26 @@ void ValidateAssertions(IEnumerable<ExpressionStatementSyntax> oldAssertions, Ex
4545
4646 var ( oldAssertions , newAssertion ) = GetAssertionsFromMethod ( method ) ;
4747
48- ValidateAssertions ( oldAssertions , newAssertion , method , tree . FilePath . Split ( ' \\ ' ) [ ^ 1 ] ) ;
48+ ValidateAssertions ( oldAssertions , newAssertion , method ) ;
4949
5050 if ( methodsMap . TryGetValue ( $ "{ method . Identifier . Text } _Failure", out var methodFailure ) )
5151 {
5252 var ( oldAssertionsFailure , newAssertionFailure ) = GetAssertionsFromMethod ( methodFailure ) ;
5353
54- ValidateAssertions ( oldAssertionsFailure , newAssertionFailure , methodFailure , tree . FilePath . Split ( ' \\ ' ) [ ^ 1 ] ) ;
54+ ValidateAssertions ( oldAssertionsFailure , newAssertionFailure , methodFailure ) ;
5555 }
5656
57- if ( methodsMap . TryGetValue ( $ "{ method . Identifier . Text } _Failure_OldAssertion", out var testWithFailureOldAssertion )
58- && methodsMap . TryGetValue ( $ "{ method . Identifier . Text } _Failure_NewAssertion", out var testWithFailureNewAssertion ) )
57+ if ( methodsMap . TryGetValue ( $ "{ method . Identifier . Text } _Failure_NewAssertion", out var testWithFailureNewAssertion ) )
5958 {
60- var ( oldAssertionsFailure , _) = GetAssertionsFromMethod ( testWithFailureOldAssertion ) ;
59+ var testWithFailureOldAssertions = methodsMap . Where ( x => x . Key . StartsWith ( $ "{ method . Identifier . Text } _Failure_OldAssertion") ) . Select ( x => x . Value ) ;
60+
6161 var ( _, newAssertionFailure ) = GetAssertionsFromMethod ( testWithFailureNewAssertion ) ;
62+ foreach ( var testWithFailureOldAssertion in testWithFailureOldAssertions )
63+ {
64+ var ( oldAssertionsFailure , _) = GetAssertionsFromMethod ( testWithFailureOldAssertion ) ;
6265
63- ValidateAssertions ( oldAssertionsFailure , newAssertionFailure , testWithFailureOldAssertion , tree . FilePath . Split ( '\\ ' ) [ ^ 1 ] ) ;
66+ ValidateAssertions ( oldAssertionsFailure , newAssertionFailure , testWithFailureOldAssertion ) ;
67+ }
6468 }
6569 }
6670
0 commit comments