@@ -43,7 +43,7 @@ public void LicenseAnalyzerHasCorrectDiagnosticId()
4343 {
4444 var analyzer = new LicenseAnalyzer ( ) ;
4545 System . Collections . Immutable . ImmutableArray < Microsoft . CodeAnalysis . DiagnosticDescriptor > descriptors = analyzer . SupportedDiagnostics ;
46- Assert . AreEqual ( 1 , descriptors . Length ) ;
46+ Assert . HasCount ( 1 , descriptors ) ;
4747 Assert . AreEqual ( "PH2155" , descriptors [ 0 ] . Id ) ;
4848 }
4949
@@ -79,9 +79,9 @@ public void LicenseAnalyzerHasCorrectSeverity()
7979 public void LicenseAnalyzerMessageFormatContainsExpectedPlaceholders ( )
8080 {
8181 var messageFormat = LicenseAnalyzer . MessageFormat ;
82- Assert . IsTrue ( messageFormat . Contains ( "{0}" ) , "Message format should contain package name placeholder" ) ;
83- Assert . IsTrue ( messageFormat . Contains ( "{1}" ) , "Message format should contain version placeholder" ) ;
84- Assert . IsTrue ( messageFormat . Contains ( "{2}" ) , "Message format should contain license placeholder" ) ;
82+ Assert . Contains ( "{0}" , messageFormat , "Message format should contain package name placeholder" ) ;
83+ Assert . Contains ( "{1}" , messageFormat , "Message format should contain version placeholder" ) ;
84+ Assert . Contains ( "{2}" , messageFormat , "Message format should contain license placeholder" ) ;
8585 }
8686
8787 [ TestMethod ]
@@ -92,10 +92,10 @@ public void LicenseAnalyzerFileNameConstantsHaveCorrectValues()
9292 var allowedLicensesFileName = LicenseAnalyzer . AllowedLicensesFileName ;
9393 var licensesCacheFileName = LicenseAnalyzer . LicensesCacheFileName ;
9494
95- Assert . IsTrue ( allowedLicensesFileName . EndsWith ( ".txt" ) ) ;
96- Assert . IsTrue ( licensesCacheFileName . EndsWith ( ".json" ) ) ;
97- Assert . IsTrue ( allowedLicensesFileName . Contains ( "Allowed" ) ) ;
98- Assert . IsTrue ( licensesCacheFileName . Contains ( "licenses" ) ) ;
95+ Assert . EndsWith ( ".txt" , allowedLicensesFileName ) ;
96+ Assert . EndsWith ( ".json" , licensesCacheFileName ) ;
97+ Assert . Contains ( "Allowed" , allowedLicensesFileName ) ;
98+ Assert . Contains ( "licenses" , licensesCacheFileName ) ;
9999 }
100100
101101 [ TestMethod ]
@@ -189,7 +189,7 @@ public void LicenseAnalyzerSupportsCompilationStartAnalysis()
189189 var analyzer = new LicenseAnalyzer ( ) ;
190190 System . Collections . Immutable . ImmutableArray < Microsoft . CodeAnalysis . DiagnosticDescriptor > supportedDiagnostics = analyzer . SupportedDiagnostics ;
191191 Assert . IsFalse ( supportedDiagnostics . IsDefault ) ;
192- Assert . AreEqual ( 1 , supportedDiagnostics . Length ) ;
192+ Assert . HasCount ( 1 , supportedDiagnostics ) ;
193193
194194 // The analyzer should be designed to work at compilation level
195195 // since it needs to analyze the entire project's dependencies
@@ -202,7 +202,7 @@ public void LicenseAnalyzerHasValidTitle()
202202 var analyzer = new LicenseAnalyzer ( ) ;
203203 Microsoft . CodeAnalysis . DiagnosticDescriptor descriptor = analyzer . SupportedDiagnostics [ 0 ] ;
204204 Assert . IsFalse ( string . IsNullOrWhiteSpace ( descriptor . Title . ToString ( ) ) ) ;
205- Assert . IsTrue ( descriptor . Title . ToString ( ) . Contains ( "License" ) ) ;
205+ Assert . Contains ( "License" , descriptor . Title . ToString ( ) ) ;
206206 }
207207
208208 [ TestMethod ]
@@ -223,7 +223,7 @@ public void LicenseAnalyzerHasValidHelpLinkUri()
223223 Assert . IsNotNull ( descriptor . HelpLinkUri ) ;
224224 }
225225
226- [ DataTestMethod ]
226+ [ TestMethod ]
227227 [ DataRow ( "MIT" ) ]
228228 [ DataRow ( "Apache-2.0" ) ]
229229 [ DataRow ( "BSD-2-Clause" ) ]
@@ -391,9 +391,9 @@ public void LicenseAnalyzerConstantsAreAccessible()
391391 Assert . IsNotNull ( LicenseAnalyzer . MessageFormat ) ;
392392
393393 // Verify they have reasonable values
394- Assert . IsTrue ( LicenseAnalyzer . AllowedLicensesFileName . Length > 0 ) ;
395- Assert . IsTrue ( LicenseAnalyzer . LicensesCacheFileName . Length > 0 ) ;
396- Assert . IsTrue ( LicenseAnalyzer . MessageFormat . Length > 0 ) ;
394+ Assert . IsGreaterThan ( 0 , LicenseAnalyzer . AllowedLicensesFileName . Length ) ;
395+ Assert . IsGreaterThan ( 0 , LicenseAnalyzer . LicensesCacheFileName . Length ) ;
396+ Assert . IsGreaterThan ( 0 , LicenseAnalyzer . MessageFormat . Length ) ;
397397 }
398398
399399 [ TestMethod ]
@@ -403,13 +403,13 @@ public void LicenseAnalyzerMessageFormatIsWellFormed()
403403 var messageFormat = LicenseAnalyzer . MessageFormat ;
404404
405405 // Should contain placeholders for package name, version, and license
406- Assert . IsTrue ( messageFormat . Contains ( "{0}" ) ) ;
407- Assert . IsTrue ( messageFormat . Contains ( "{1}" ) ) ;
408- Assert . IsTrue ( messageFormat . Contains ( "{2}" ) ) ;
406+ Assert . Contains ( "{0}" , messageFormat ) ;
407+ Assert . Contains ( "{1}" , messageFormat ) ;
408+ Assert . Contains ( "{2}" , messageFormat ) ;
409409
410410 // Should contain meaningful text
411- Assert . IsTrue ( messageFormat . Contains ( "Package" ) ) ;
412- Assert . IsTrue ( messageFormat . Contains ( "license" ) ) ;
411+ Assert . Contains ( "Package" , messageFormat ) ;
412+ Assert . Contains ( "license" , messageFormat ) ;
413413 }
414414
415415 [ TestMethod ]
@@ -419,7 +419,7 @@ public void LicenseAnalyzerCacheFileNameConstant()
419419 // Verify the cache file name constant has a proper value
420420 var fileName = LicenseAnalyzer . LicensesCacheFileName ;
421421 Assert . IsFalse ( string . IsNullOrEmpty ( fileName ) ) ;
422- Assert . IsTrue ( fileName . EndsWith ( ".json" ) ) ;
422+ Assert . EndsWith ( ".json" , fileName ) ;
423423 Assert . AreEqual ( "licenses.json" , fileName ) ;
424424 }
425425
@@ -430,7 +430,7 @@ public void LicenseAnalyzerAllowedLicensesFileNameConstant()
430430 // Verify the allowed licenses file name constant has a proper value
431431 var fileName = LicenseAnalyzer . AllowedLicensesFileName ;
432432 Assert . IsFalse ( string . IsNullOrEmpty ( fileName ) ) ;
433- Assert . IsTrue ( fileName . EndsWith ( ".txt" ) ) ;
433+ Assert . EndsWith ( ".txt" , fileName ) ;
434434 Assert . AreEqual ( "Allowed.Licenses.txt" , fileName ) ;
435435 }
436436
@@ -765,9 +765,9 @@ public void LicenseAnalyzerDescriptorConsistency()
765765
766766 // Verify descriptor consistency
767767 Assert . AreEqual ( "PH2155" , descriptor . Id ) ;
768- Assert . IsTrue ( descriptor . Title . ToString ( ) . Length > 0 ) ;
769- Assert . IsTrue ( descriptor . MessageFormat . ToString ( ) . Length > 0 ) ;
770- Assert . IsTrue ( descriptor . Description . ToString ( ) . Length > 0 ) ;
768+ Assert . IsGreaterThan ( 0 , descriptor . Title . ToString ( ) . Length ) ;
769+ Assert . IsGreaterThan ( 0 , descriptor . MessageFormat . ToString ( ) . Length ) ;
770+ Assert . IsGreaterThan ( 0 , descriptor . Description . ToString ( ) . Length ) ;
771771 Assert . AreEqual ( "Philips Security" , descriptor . Category ) ;
772772 Assert . IsFalse ( descriptor . IsEnabledByDefault ) ;
773773 }
0 commit comments