@@ -74,5 +74,53 @@ public void scripts_not_embedded_resources_with_approved_exceptions()
7474
7575 Convention . IsWithApprovedExeptions ( new FilesAreEmbeddedResources ( ".sql" ) , project ) ;
7676 }
77+
78+ [ Test ]
79+ public void release_debug_type_should_be_pdb_only ( )
80+ {
81+ projectProvider
82+ . LoadProjectDocument ( Arg . Any < string > ( ) )
83+ . Returns ( XDocument . Parse ( Resources . ProjectFileWithReleaseDebugTypeFull ) ) ;
84+
85+ var projectLocator = Substitute . For < IProjectLocator > ( ) ;
86+ 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 ) ) ;
90+
91+ Approvals . Verify ( ex . Message ) ;
92+ }
93+
94+ [ Test ]
95+ public void all_configuration_groups_should_have_platform_AnyCPU ( )
96+ {
97+ projectProvider
98+ . LoadProjectDocument ( Arg . Any < string > ( ) )
99+ . Returns ( XDocument . Parse ( Resources . ProjectFileWithReleaseDebugTypeFull ) ) ;
100+
101+ var projectLocator = Substitute . For < IProjectLocator > ( ) ;
102+ 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 ) ) ;
106+
107+ Approvals . Verify ( ex . Message ) ;
108+ }
109+
110+ [ Test ]
111+ public void all_configuration_groups_should_have_optimize_true_if_property_defined ( )
112+ {
113+ projectProvider
114+ . LoadProjectDocument ( Arg . Any < string > ( ) )
115+ . Returns ( XDocument . Parse ( Resources . ProjectFileWithReleaseDebugTypeFull ) ) ;
116+
117+ var projectLocator = Substitute . For < IProjectLocator > ( ) ;
118+ 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 ) ) ;
122+
123+ Approvals . Verify ( ex . Message ) ;
124+ }
77125 }
78126}
0 commit comments