@@ -68,7 +68,7 @@ private static void VerifyDiagnosticResults(IEnumerable<Diagnostic> actualResult
6868 {
6969 string diagnosticsOutput = actualResults . Any ( ) ? DiagnosticVerifier . FormatDiagnostics ( analyzer , actualResults . ToArray ( ) ) : " NONE." ;
7070
71- Assert . IsTrue ( false ,
71+ Assert . Fail (
7272 string . Format ( "Mismatch between number of diagnostics returned, expected \" {0}\" actual \" {1}\" \r \n \r \n Diagnostics:\r \n {2}\r \n " , expectedCount , actualCount , diagnosticsOutput ) ) ;
7373 }
7474
@@ -81,7 +81,7 @@ private static void VerifyDiagnosticResults(IEnumerable<Diagnostic> actualResult
8181 {
8282 if ( actual . Location != Location . None )
8383 {
84- Assert . IsTrue ( false ,
84+ Assert . Fail (
8585 string . Format ( "Expected:\n A project diagnostic with No location\n Actual:\n {0}" ,
8686 DiagnosticVerifier . FormatDiagnostics ( analyzer , actual ) ) ) ;
8787 }
@@ -93,7 +93,7 @@ private static void VerifyDiagnosticResults(IEnumerable<Diagnostic> actualResult
9393
9494 if ( additionalLocations . Length != expected . Locations . Length - 1 )
9595 {
96- Assert . IsTrue ( false ,
96+ Assert . Fail (
9797 string . Format ( "Expected {0} additional locations but got {1} for Diagnostic:\r \n {2}\r \n " ,
9898 expected . Locations . Length - 1 , additionalLocations . Length ,
9999 DiagnosticVerifier . FormatDiagnostics ( analyzer , actual ) ) ) ;
@@ -107,21 +107,21 @@ private static void VerifyDiagnosticResults(IEnumerable<Diagnostic> actualResult
107107
108108 if ( actual . Id != expected . Id )
109109 {
110- Assert . IsTrue ( false ,
110+ Assert . Fail (
111111 string . Format ( "Expected diagnostic id to be \" {0}\" was \" {1}\" \r \n \r \n Diagnostic:\r \n {2}\r \n " ,
112112 expected . Id , actual . Id , DiagnosticVerifier . FormatDiagnostics ( analyzer , actual ) ) ) ;
113113 }
114114
115115 if ( actual . Severity != expected . Severity )
116116 {
117- Assert . IsTrue ( false ,
117+ Assert . Fail (
118118 string . Format ( "Expected diagnostic severity to be \" {0}\" was \" {1}\" \r \n \r \n Diagnostic:\r \n {2}\r \n " ,
119119 expected . Severity , actual . Severity , DiagnosticVerifier . FormatDiagnostics ( analyzer , actual ) ) ) ;
120120 }
121121
122122 if ( actual . GetMessage ( ) != expected . Message )
123123 {
124- Assert . IsTrue ( false ,
124+ Assert . Fail (
125125 string . Format ( "Expected diagnostic message to be \" {0}\" was \" {1}\" \r \n \r \n Diagnostic:\r \n {2}\r \n " ,
126126 expected . Message , actual . GetMessage ( ) , DiagnosticVerifier . FormatDiagnostics ( analyzer , actual ) ) ) ;
127127 }
@@ -139,7 +139,7 @@ private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagno
139139 {
140140 var actualSpan = actual . GetLineSpan ( ) ;
141141
142- Assert . IsTrue ( actualSpan . Path == expected . Path || ( actualSpan . Path != null && actualSpan . Path . Contains ( "Test0." ) && expected . Path . Contains ( "Test." ) ) ,
142+ Assert . That ( actualSpan . Path == expected . Path || ( actualSpan . Path != null && actualSpan . Path . Contains ( "Test0." ) && expected . Path . Contains ( "Test." ) ) ,
143143 string . Format ( "Expected diagnostic to be in file \" {0}\" was actually in file \" {1}\" \r \n \r \n Diagnostic:\r \n {2}\r \n " ,
144144 expected . Path , actualSpan . Path , DiagnosticVerifier . FormatDiagnostics ( analyzer , diagnostic ) ) ) ;
145145
@@ -150,7 +150,7 @@ private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagno
150150 {
151151 if ( actualLinePosition . Line + 1 != expected . Line )
152152 {
153- Assert . IsTrue ( false ,
153+ Assert . Fail (
154154 string . Format ( "Expected diagnostic to be on line \" {0}\" was actually on line \" {1}\" \r \n \r \n Diagnostic:\r \n {2}\r \n " ,
155155 expected . Line , actualLinePosition . Line + 1 , DiagnosticVerifier . FormatDiagnostics ( analyzer , diagnostic ) ) ) ;
156156 }
@@ -161,7 +161,7 @@ private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagno
161161 {
162162 if ( actualLinePosition . Character + 1 != expected . Column )
163163 {
164- Assert . IsTrue ( false ,
164+ Assert . Fail (
165165 string . Format ( "Expected diagnostic to start at column \" {0}\" was actually at column \" {1}\" \r \n \r \n Diagnostic:\r \n {2}\r \n " ,
166166 expected . Column , actualLinePosition . Character + 1 , DiagnosticVerifier . FormatDiagnostics ( analyzer , diagnostic ) ) ) ;
167167 }
@@ -197,7 +197,7 @@ private static string FormatDiagnostics(DiagnosticAnalyzer analyzer, params Diag
197197 }
198198 else
199199 {
200- Assert . IsTrue ( location . IsInSource ,
200+ Assert . That ( location . IsInSource ,
201201 $ "Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata: { diagnostics [ i ] } \r \n ") ;
202202
203203 var linePosition = diagnostics [ i ] . Location . GetLineSpan ( ) . StartLinePosition ;
0 commit comments