11namespace TestStack . ConventionTests . Tests
22{
33 using System . Xml . Linq ;
4- using ApprovalTests ;
5- using ApprovalTests . Reporters ;
64 using NSubstitute ;
75 using NUnit . Framework ;
6+ using Shouldly ;
87 using TestStack . ConventionTests . ConventionData ;
98 using TestStack . ConventionTests . Conventions ;
109 using TestStack . ConventionTests . Internal ;
1110 using TestStack . ConventionTests . Tests . Properties ;
1211
1312 [ TestFixture ]
14- [ UseReporter ( typeof ( DiffReporter ) ) ]
1513 public class ProjectBasedConventions
1614 {
1715 IProjectProvider projectProvider ;
@@ -31,9 +29,9 @@ public void assemblies_referencing_bin_obj()
3129
3230 var projectLocator = Substitute . For < IProjectLocator > ( ) ;
3331 var project = new ProjectReferences ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
34- var ex = Assert . Throws < ConventionFailedException > ( ( ) => Convention . Is ( new ProjectDoesNotReferenceDllsFromBinOrObjDirectories ( ) , project ) ) ;
35-
36- Approvals . Verify ( ex . Message ) ;
32+ var failures = Convention . GetFailures ( new ProjectDoesNotReferenceDllsFromBinOrObjDirectories ( ) , project ) ;
33+
34+ failures . ShouldMatchApproved ( ) ;
3735 }
3836
3937 [ Test ]
@@ -46,7 +44,9 @@ public void assemblies_referencing_bin_obj_with_approved_exceptions()
4644
4745 var projectLocator = Substitute . For < IProjectLocator > ( ) ;
4846 var project = new ProjectReferences ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
49- Convention . IsWithApprovedExeptions ( new ProjectDoesNotReferenceDllsFromBinOrObjDirectories ( ) , project ) ;
47+ var failures = Convention . GetFailures ( new ProjectDoesNotReferenceDllsFromBinOrObjDirectories ( ) , project ) ;
48+
49+ failures . ShouldMatchApproved ( ) ;
5050 }
5151
5252 [ Test ]
@@ -58,9 +58,9 @@ public void scripts_not_embedded_resources()
5858
5959 var projectLocator = Substitute . For < IProjectLocator > ( ) ;
6060 var project = new ProjectFileItems ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
61- var ex = Assert . Throws < ConventionFailedException > ( ( ) => Convention . Is ( new FilesAreEmbeddedResources ( ".sql" ) , project ) ) ;
61+ var failures = Convention . GetFailures ( new FilesAreEmbeddedResources ( ".sql" ) , project ) ;
6262
63- Approvals . Verify ( ex . Message ) ;
63+ failures . ShouldMatchApproved ( ) ;
6464 }
6565
6666 [ Test ]
@@ -72,7 +72,7 @@ public void scripts_not_embedded_resources_with_approved_exceptions()
7272 . LoadProjectDocument ( Arg . Any < string > ( ) )
7373 . Returns ( XDocument . Parse ( Resources . ProjectFileWithInvalidSqlScriptFile ) ) ;
7474
75- Convention . IsWithApprovedExeptions ( new FilesAreEmbeddedResources ( ".sql" ) , project ) ;
75+ Convention . GetFailures ( new FilesAreEmbeddedResources ( ".sql" ) , project ) ;
7676 }
7777
7878 [ Test ]
@@ -84,11 +84,9 @@ public void release_debug_type_should_be_pdb_only()
8484
8585 var projectLocator = Substitute . For < IProjectLocator > ( ) ;
8686 var propertyGroups = new ProjectPropertyGroups ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
87- var ex =
88- Assert . Throws < ConventionFailedException > (
89- ( ) => Convention . Is ( new ConfigurationHasSpecificValue ( ConfigurationType . Release , "DebugType" , "pdbonly" ) , propertyGroups ) ) ;
87+ var failures = Convention . GetFailures ( new ConfigurationHasSpecificValue ( ConfigurationType . Release , "DebugType" , "pdbonly" ) , propertyGroups ) ;
9088
91- Approvals . Verify ( ex . Message ) ;
89+ failures . ShouldMatchApproved ( ) ;
9290 }
9391
9492 [ Test ]
@@ -100,11 +98,9 @@ public void all_configuration_groups_should_have_platform_AnyCPU()
10098
10199 var projectLocator = Substitute . For < IProjectLocator > ( ) ;
102100 var propertyGroups = new ProjectPropertyGroups ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
103- var ex =
104- Assert . Throws < ConventionFailedException > (
105- ( ) => Convention . Is ( new ConfigurationHasSpecificValue ( ConfigurationType . All , "Platform" , "AnyCPU" ) , propertyGroups ) ) ;
101+ var failures = Convention . GetFailures ( new ConfigurationHasSpecificValue ( ConfigurationType . All , "Platform" , "AnyCPU" ) , propertyGroups ) ;
106102
107- Approvals . Verify ( ex . Message ) ;
103+ failures . ShouldMatchApproved ( ) ;
108104 }
109105
110106 [ Test ]
@@ -116,11 +112,11 @@ public void all_configuration_groups_should_have_optimize_true_if_property_defin
116112
117113 var projectLocator = Substitute . For < IProjectLocator > ( ) ;
118114 var propertyGroups = new ProjectPropertyGroups ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
119- var ex =
120- Assert . Throws < ConventionFailedException > (
121- ( ) => Convention . Is ( new ConfigurationHasSpecificValue ( ConfigurationType . All , "Optimize" , "true" ) , propertyGroups ) ) ;
115+ var failures =
116+ Convention . GetFailures ( new ConfigurationHasSpecificValue ( ConfigurationType . All , "Optimize" , "true" ) ,
117+ propertyGroups ) ;
122118
123- Approvals . Verify ( ex . Message ) ;
119+ failures . ShouldMatchApproved ( ) ;
124120 }
125121 }
126122}
0 commit comments