@@ -10,12 +10,34 @@ namespace RubberduckTests.Inspections
10
10
[ TestFixture ]
11
11
public class OptionExplicitInspectionTests
12
12
{
13
+ private const string OptionExplicitNotSpecified = @"
14
+ Sub DoSomething()
15
+ End Sub" ;
16
+
13
17
[ Test ]
14
18
[ Category ( "Inspections" ) ]
15
- public void NotAlreadySpecified_ReturnsResult ( )
19
+ public void EmptyModule_NoResult ( )
16
20
{
17
21
const string inputCode = @"" ;
18
22
23
+ var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
24
+ using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
25
+ {
26
+
27
+ var inspection = new OptionExplicitInspection ( state ) ;
28
+ var inspector = InspectionsHelper . GetInspector ( inspection ) ;
29
+ var inspectionResults = inspector . FindIssuesAsync ( state , CancellationToken . None ) . Result ;
30
+
31
+ Assert . AreEqual ( 0 , inspectionResults . Count ( ) ) ;
32
+ }
33
+ }
34
+
35
+ [ Test ]
36
+ [ Category ( "Inspections" ) ]
37
+ public void NotAlreadySpecified_ReturnsResult ( )
38
+ {
39
+ const string inputCode = OptionExplicitNotSpecified ;
40
+
19
41
var vbe = MockVbeBuilder . BuildFromSingleStandardModule ( inputCode , out _ ) ;
20
42
using ( var state = MockParser . CreateAndParse ( vbe . Object ) )
21
43
{
@@ -50,7 +72,7 @@ public void AlreadySpecified_DoesNotReturnResult()
50
72
[ Category ( "Inspections" ) ]
51
73
public void NotAlreadySpecified_ReturnsMultipleResults ( )
52
74
{
53
- const string inputCode = @"" ;
75
+ const string inputCode = OptionExplicitNotSpecified ;
54
76
55
77
var builder = new MockVbeBuilder ( ) ;
56
78
var project = builder . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
@@ -74,7 +96,7 @@ public void NotAlreadySpecified_ReturnsMultipleResults()
74
96
[ Category ( "Inspections" ) ]
75
97
public void PartiallySpecified_ReturnsResults ( )
76
98
{
77
- const string inputCode1 = @"" ;
99
+ const string inputCode1 = OptionExplicitNotSpecified ;
78
100
const string inputCode2 = @"Option Explicit" ;
79
101
80
102
var builder = new MockVbeBuilder ( ) ;
0 commit comments