88namespace RubberduckTests . Inspections
99{
1010 [ TestFixture ]
11+ [ Category ( "Inspections" ) ]
12+ [ Category ( "UnderscoreInPublicMember" ) ]
1113 public class UnderscoreInPublicClassModuleMemberInspectionTests
1214 {
1315 [ Test ]
14- [ Category ( "Inspections" ) ]
1516 public void BasicExample_Sub ( )
1617 {
1718 const string inputCode =
@@ -29,7 +30,48 @@ public void BasicExample_Sub()
2930 }
3031
3132 [ 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 ]
3375 public void BasicExample_Function ( )
3476 {
3577 const string inputCode =
@@ -47,7 +89,6 @@ public void BasicExample_Function()
4789 }
4890
4991 [ Test ]
50- [ Category ( "Inspections" ) ]
5192 public void BasicExample_Property ( )
5293 {
5394 const string inputCode =
@@ -65,7 +106,6 @@ public void BasicExample_Property()
65106 }
66107
67108 [ Test ]
68- [ Category ( "Inspections" ) ]
69109 public void StandardModule ( )
70110 {
71111 const string inputCode =
@@ -83,7 +123,6 @@ public void StandardModule()
83123 }
84124
85125 [ Test ]
86- [ Category ( "Inspections" ) ]
87126 public void NoUnderscore ( )
88127 {
89128 const string inputCode =
@@ -101,7 +140,6 @@ public void NoUnderscore()
101140 }
102141
103142 [ Test ]
104- [ Category ( "Inspections" ) ]
105143 public void FriendMember_WithUnderscore ( )
106144 {
107145 const string inputCode =
@@ -119,7 +157,6 @@ public void FriendMember_WithUnderscore()
119157 }
120158
121159 [ Test ]
122- [ Category ( "Inspections" ) ]
123160 public void Implicit_WithUnderscore ( )
124161 {
125162 const string inputCode =
@@ -137,7 +174,6 @@ public void Implicit_WithUnderscore()
137174 }
138175
139176 [ Test ]
140- [ Category ( "Inspections" ) ]
141177 public void ImplementsInterface ( )
142178 {
143179 const string inputCode1 =
0 commit comments