@@ -18,17 +18,17 @@ public class ProjectBasedConventions
18
18
public void Setup ( )
19
19
{
20
20
projectProvider = Substitute . For < IProjectProvider > ( ) ;
21
+ projectProvider . GetName ( ) . Returns ( "ProjectName" ) ;
21
22
}
22
23
23
24
[ Test ]
24
25
public void assemblies_referencing_bin_obj ( )
25
26
{
26
27
projectProvider
27
- . LoadProjectDocument ( Arg . Any < string > ( ) )
28
+ . LoadProjectDocument ( )
28
29
. Returns ( XDocument . Parse ( Resources . ProjectFileWithBinReference ) ) ;
29
-
30
- var projectLocator = Substitute . For < IProjectLocator > ( ) ;
31
- var project = new ProjectReferences ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
30
+
31
+ var project = new ProjectReferences ( projectProvider ) ;
32
32
var failures = Convention . GetFailures ( new ProjectDoesNotReferenceDllsFromBinOrObjDirectories ( ) , project ) ;
33
33
34
34
failures . ShouldMatchApproved ( ) ;
@@ -38,12 +38,10 @@ public void assemblies_referencing_bin_obj()
38
38
public void assemblies_referencing_bin_obj_with_approved_exceptions ( )
39
39
{
40
40
projectProvider
41
- . LoadProjectDocument ( Arg . Any < string > ( ) )
41
+ . LoadProjectDocument ( )
42
42
. Returns ( XDocument . Parse ( Resources . ProjectFileWithBinReference ) ) ;
43
43
44
-
45
- var projectLocator = Substitute . For < IProjectLocator > ( ) ;
46
- var project = new ProjectReferences ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
44
+ var project = new ProjectReferences ( projectProvider ) ;
47
45
var failures = Convention . GetFailures ( new ProjectDoesNotReferenceDllsFromBinOrObjDirectories ( ) , project ) ;
48
46
49
47
failures . ShouldMatchApproved ( ) ;
@@ -53,11 +51,10 @@ public void assemblies_referencing_bin_obj_with_approved_exceptions()
53
51
public void scripts_not_embedded_resources ( )
54
52
{
55
53
projectProvider
56
- . LoadProjectDocument ( Arg . Any < string > ( ) )
54
+ . LoadProjectDocument ( )
57
55
. Returns ( XDocument . Parse ( Resources . ProjectFileWithInvalidSqlScriptFile ) ) ;
58
-
59
- var projectLocator = Substitute . For < IProjectLocator > ( ) ;
60
- var project = new ProjectFileItems ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
56
+
57
+ var project = new ProjectFileItems ( projectProvider ) ;
61
58
var failures = Convention . GetFailures ( new FilesAreEmbeddedResources ( ".sql" ) , project ) ;
62
59
63
60
failures . ShouldMatchApproved ( ) ;
@@ -66,10 +63,9 @@ public void scripts_not_embedded_resources()
66
63
[ Test ]
67
64
public void scripts_not_embedded_resources_with_approved_exceptions ( )
68
65
{
69
- var projectLocator = Substitute . For < IProjectLocator > ( ) ;
70
- var project = new ProjectFileItems ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
66
+ var project = new ProjectFileItems ( projectProvider ) ;
71
67
projectProvider
72
- . LoadProjectDocument ( Arg . Any < string > ( ) )
68
+ . LoadProjectDocument ( )
73
69
. Returns ( XDocument . Parse ( Resources . ProjectFileWithInvalidSqlScriptFile ) ) ;
74
70
75
71
Convention . GetFailures ( new FilesAreEmbeddedResources ( ".sql" ) , project ) ;
@@ -79,11 +75,10 @@ public void scripts_not_embedded_resources_with_approved_exceptions()
79
75
public void release_debug_type_should_be_pdb_only ( )
80
76
{
81
77
projectProvider
82
- . LoadProjectDocument ( Arg . Any < string > ( ) )
78
+ . LoadProjectDocument ( )
83
79
. Returns ( XDocument . Parse ( Resources . ProjectFileWithReleaseDebugTypeFull ) ) ;
84
80
85
- var projectLocator = Substitute . For < IProjectLocator > ( ) ;
86
- var propertyGroups = new ProjectPropertyGroups ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
81
+ var propertyGroups = new ProjectPropertyGroups ( projectProvider ) ;
87
82
var failures = Convention . GetFailures ( new ConfigurationHasSpecificValue ( ConfigurationType . Release , "DebugType" , "pdbonly" ) , propertyGroups ) ;
88
83
89
84
failures . ShouldMatchApproved ( ) ;
@@ -93,11 +88,10 @@ public void release_debug_type_should_be_pdb_only()
93
88
public void all_configuration_groups_should_have_platform_AnyCPU ( )
94
89
{
95
90
projectProvider
96
- . LoadProjectDocument ( Arg . Any < string > ( ) )
91
+ . LoadProjectDocument ( )
97
92
. Returns ( XDocument . Parse ( Resources . ProjectFileWithReleaseDebugTypeFull ) ) ;
98
93
99
- var projectLocator = Substitute . For < IProjectLocator > ( ) ;
100
- var propertyGroups = new ProjectPropertyGroups ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
94
+ var propertyGroups = new ProjectPropertyGroups ( projectProvider ) ;
101
95
var failures = Convention . GetFailures ( new ConfigurationHasSpecificValue ( ConfigurationType . All , "Platform" , "AnyCPU" ) , propertyGroups ) ;
102
96
103
97
failures . ShouldMatchApproved ( ) ;
@@ -107,11 +101,10 @@ public void all_configuration_groups_should_have_platform_AnyCPU()
107
101
public void all_configuration_groups_should_have_optimize_true_if_property_defined ( )
108
102
{
109
103
projectProvider
110
- . LoadProjectDocument ( Arg . Any < string > ( ) )
104
+ . LoadProjectDocument ( )
111
105
. Returns ( XDocument . Parse ( Resources . ProjectFileWithReleaseDebugTypeFull ) ) ;
112
106
113
- var projectLocator = Substitute . For < IProjectLocator > ( ) ;
114
- var propertyGroups = new ProjectPropertyGroups ( typeof ( ProjectBasedConventions ) . Assembly , projectProvider , projectLocator ) ;
107
+ var propertyGroups = new ProjectPropertyGroups ( projectProvider ) ;
115
108
var failures =
116
109
Convention . GetFailures ( new ConfigurationHasSpecificValue ( ConfigurationType . All , "Optimize" , "true" ) ,
117
110
propertyGroups ) ;
0 commit comments