7
7
namespace RubberduckTests . Inspections
8
8
{
9
9
[ TestFixture ]
10
+ [ Category ( "EncapsulatePublicFieldInspection" ) ]
10
11
public class EncapsulatePublicFieldInspectionTests
11
12
{
12
13
[ Test ]
13
- [ Category ( "Inspections" ) ]
14
14
public void PublicField_ReturnsResult ( )
15
15
{
16
16
const string inputCode =
17
17
@"Public fizz As Boolean" ;
18
18
var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
19
19
using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
20
20
{
21
+ var inspection = new EncapsulatePublicFieldInspection ( state ) ;
22
+ var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
23
+
24
+ Assert . AreEqual ( 1 , inspectionResults . Count ( ) ) ;
25
+ }
26
+ }
21
27
28
+ [ Test ]
29
+ public void GlobalField_ReturnsResult ( )
30
+ {
31
+ const string inputCode =
32
+ @"Global fizz As Boolean" ;
33
+ var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
34
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
35
+ {
22
36
var inspection = new EncapsulatePublicFieldInspection ( state ) ;
23
37
var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
24
38
@@ -27,7 +41,6 @@ public void PublicField_ReturnsResult()
27
41
}
28
42
29
43
[ Test ]
30
- [ Category ( "Inspections" ) ]
31
44
public void MultiplePublicFields_ReturnMultipleResult ( )
32
45
{
33
46
const string inputCode =
@@ -46,15 +59,13 @@ public void MultiplePublicFields_ReturnMultipleResult()
46
59
}
47
60
48
61
[ Test ]
49
- [ Category ( "Inspections" ) ]
50
62
public void PrivateField_DoesNotReturnResult ( )
51
63
{
52
64
const string inputCode =
53
65
@"Private fizz As Boolean" ;
54
66
var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
55
67
using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
56
68
{
57
-
58
69
var inspection = new EncapsulatePublicFieldInspection ( state ) ;
59
70
var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
60
71
@@ -63,7 +74,6 @@ public void PrivateField_DoesNotReturnResult()
63
74
}
64
75
65
76
[ Test ]
66
- [ Category ( "Inspections" ) ]
67
77
public void PublicNonField_DoesNotReturnResult ( )
68
78
{
69
79
const string inputCode =
@@ -72,7 +82,6 @@ public void PublicNonField_DoesNotReturnResult()
72
82
var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
73
83
using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
74
84
{
75
-
76
85
var inspection = new EncapsulatePublicFieldInspection ( state ) ;
77
86
var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
78
87
@@ -81,7 +90,6 @@ public void PublicNonField_DoesNotReturnResult()
81
90
}
82
91
83
92
[ Test ]
84
- [ Category ( "Inspections" ) ]
85
93
public void PublicField_Ignored_DoesNotReturnResult ( )
86
94
{
87
95
const string inputCode =
@@ -90,7 +98,6 @@ public void PublicField_Ignored_DoesNotReturnResult()
90
98
var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
91
99
using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
92
100
{
93
-
94
101
var inspection = new EncapsulatePublicFieldInspection ( state ) ;
95
102
var inspectionResults = inspection . GetInspectionResults ( CancellationToken . None ) ;
96
103
@@ -99,7 +106,6 @@ public void PublicField_Ignored_DoesNotReturnResult()
99
106
}
100
107
101
108
[ Test ]
102
- [ Category ( "Inspections" ) ]
103
109
public void InspectionName ( )
104
110
{
105
111
const string inspectionName = "EncapsulatePublicFieldInspection" ;
0 commit comments