8
8
namespace RubberduckTests . Inspections
9
9
{
10
10
[ TestFixture ]
11
+ [ Category ( "Inspections" ) ]
12
+ [ Category ( "UnderscoreInPublicMember" ) ]
11
13
public class UnderscoreInPublicClassModuleMemberInspectionTests
12
14
{
13
15
[ Test ]
14
- [ Category ( "Inspections" ) ]
15
16
public void BasicExample_Sub ( )
16
17
{
17
18
const string inputCode =
@@ -29,7 +30,48 @@ public void BasicExample_Sub()
29
30
}
30
31
31
32
[ Test ]
32
- [ Category ( "Inspections" ) ]
33
+ public void Basic_Ignored ( )
34
+ {
35
+ const string inputCode =
36
+ @"'@Ignore UnderscoreInPublicClassModuleMember
37
+ Public Sub This_Is_Ignored()
38
+ End Sub
39
+
40
+ Public Sub This_Should_Be_Marked()
41
+ End Sub" ;
42
+ var vbe = MockVbeBuilder . BuildFromSingleModule ( inputCode , ComponentType . ClassModule , out _ ) ;
43
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
44
+ {
45
+ var inspection = new UnderscoreInPublicClassModuleMemberInspection ( state ) ;
46
+ var inspector = InspectionsHelper . GetInspector ( inspection ) ;
47
+ var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
48
+
49
+ Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
50
+ }
51
+ }
52
+
53
+ [ Test ]
54
+ public void Basic_IgnoreModule ( )
55
+ {
56
+ const string inputCode =
57
+ @"'@IgnoreModule UnderscoreInPublicClassModuleMember
58
+ Public Sub This_Is_Ignored()
59
+ End Sub
60
+
61
+ Public Sub This_Is_Also_Ignored()
62
+ End Sub" ;
63
+ var vbe = MockVbeBuilder . BuildFromSingleModule ( inputCode , ComponentType . ClassModule , out _ ) ;
64
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
65
+ {
66
+ var inspection = new UnderscoreInPublicClassModuleMemberInspection ( state ) ;
67
+ var inspector = InspectionsHelper . GetInspector ( inspection ) ;
68
+ var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
69
+
70
+ Assert . AreEqual ( 0 , inspectionResults . Count ( ) ) ;
71
+ }
72
+ }
73
+
74
+ [ Test ]
33
75
public void BasicExample_Function ( )
34
76
{
35
77
const string inputCode =
@@ -47,7 +89,6 @@ public void BasicExample_Function()
47
89
}
48
90
49
91
[ Test ]
50
- [ Category ( "Inspections" ) ]
51
92
public void BasicExample_Property ( )
52
93
{
53
94
const string inputCode =
@@ -65,7 +106,6 @@ public void BasicExample_Property()
65
106
}
66
107
67
108
[ Test ]
68
- [ Category ( "Inspections" ) ]
69
109
public void StandardModule ( )
70
110
{
71
111
const string inputCode =
@@ -83,7 +123,6 @@ public void StandardModule()
83
123
}
84
124
85
125
[ Test ]
86
- [ Category ( "Inspections" ) ]
87
126
public void NoUnderscore ( )
88
127
{
89
128
const string inputCode =
@@ -101,7 +140,6 @@ public void NoUnderscore()
101
140
}
102
141
103
142
[ Test ]
104
- [ Category ( "Inspections" ) ]
105
143
public void FriendMember_WithUnderscore ( )
106
144
{
107
145
const string inputCode =
@@ -119,7 +157,6 @@ public void FriendMember_WithUnderscore()
119
157
}
120
158
121
159
[ Test ]
122
- [ Category ( "Inspections" ) ]
123
160
public void Implicit_WithUnderscore ( )
124
161
{
125
162
const string inputCode =
@@ -137,7 +174,6 @@ public void Implicit_WithUnderscore()
137
174
}
138
175
139
176
[ Test ]
140
- [ Category ( "Inspections" ) ]
141
177
public void ImplementsInterface ( )
142
178
{
143
179
const string inputCode1 =
0 commit comments