Skip to content

Commit f747533

Browse files
authored
Merge pull request #5226 from BZngr/5191_I_thru_Z
Complete InspectionTestsBase incorporation
2 parents 3370982 + 5b2180a commit f747533

File tree

82 files changed

+1431
-5262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1431
-5262
lines changed

RubberduckTests/Inspections/ApplicationWorksheetFunctionInspectionTests.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using System.Threading;
43
using NUnit.Framework;
54
using Rubberduck.Inspections.Concrete;
65
using Rubberduck.Parsing.Inspections.Abstract;
76
using Rubberduck.Parsing.VBA;
87
using Rubberduck.VBEditor.SafeComWrappers;
9-
using RubberduckTests.Mocks;
108

119
namespace RubberduckTests.Inspections
1210
{
1311
[TestFixture]
1412
public class ApplicationWorksheetFunctionInspectionTests : InspectionTestsBase
1513
{
1614
private IEnumerable<IInspectionResult> GetInspectionResultsUsingExcelLibrary(string inputCode)
17-
{
18-
var builder = new MockVbeBuilder();
19-
var project = builder.ProjectBuilder("VBAProject", ProjectProtection.Unprotected)
20-
.AddComponent("Module1", ComponentType.StandardModule, inputCode)
21-
.AddReference("Excel", MockVbeBuilder.LibraryPathMsExcel, 1, 8, true)
22-
.Build();
23-
24-
var vbe = builder.AddProject(project).Build().Object;
25-
return InspectionResults(vbe);
26-
}
15+
=> InspectionResultsForModules(("Module1", inputCode, ComponentType.StandardModule), "Excel");
2716

2817
[Test]
2918
[Category("Inspections")]

RubberduckTests/Inspections/AssignedByValParameterInspectionTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System.Linq;
2-
using System.Threading;
32
using NUnit.Framework;
4-
using RubberduckTests.Mocks;
53
using Rubberduck.Inspections.Concrete;
64
using Rubberduck.VBEditor.SafeComWrappers;
75
using Rubberduck.Parsing.Inspections.Abstract;

RubberduckTests/Inspections/AssignmentNotUsedInspectionTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Rubberduck.Inspections.Concrete;
55
using RubberduckTests.Mocks;
66
using System.Linq;
7-
using System.Threading;
87
using Rubberduck.Parsing.Inspections.Abstract;
98
using Rubberduck.Parsing.VBA;
109

RubberduckTests/Inspections/AttributeValueOutOfSyncInspectionTests.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using System.Threading;
43
using NUnit.Framework;
54
using Rubberduck.Inspections.Concrete;
65
using Rubberduck.Parsing.Annotations;
76
using Rubberduck.Parsing.Inspections.Abstract;
87
using Rubberduck.Parsing.VBA;
98
using Rubberduck.VBEditor.SafeComWrappers;
10-
using RubberduckTests.Mocks;
119

1210
namespace RubberduckTests.Inspections
1311
{
@@ -229,10 +227,7 @@ Public Sub Foo()
229227
}
230228

231229
private IEnumerable<IInspectionResult> InspectionResults(string inputCode, ComponentType componentType = ComponentType.StandardModule)
232-
{
233-
var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, componentType, out _).Object;
234-
return InspectionResults(vbe);
235-
}
230+
=> InspectionResultsForModules(("TestComponent", inputCode, componentType));
236231

237232
protected override IInspection InspectionUnderTest(RubberduckParserState state)
238233
{

RubberduckTests/Inspections/BooleanAssignedInIfElseInspectionTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System.Linq;
2-
using System.Threading;
32
using NUnit.Framework;
43
using Rubberduck.Inspections.Concrete;
54
using Rubberduck.Parsing.Inspections.Abstract;
65
using Rubberduck.Parsing.VBA;
7-
using RubberduckTests.Mocks;
86

97
namespace RubberduckTests.Inspections
108
{

RubberduckTests/Inspections/ConstantNotUsedInspectionTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System.Linq;
2-
using System.Threading;
32
using NUnit.Framework;
43
using Rubberduck.Inspections.Concrete;
54
using Rubberduck.Parsing.Inspections.Abstract;
65
using Rubberduck.Parsing.VBA;
7-
using RubberduckTests.Mocks;
86

97
namespace RubberduckTests.Inspections
108
{

RubberduckTests/Inspections/EmptyForEachBlockInspectionTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System.Linq;
2-
using System.Threading;
32
using NUnit.Framework;
4-
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
5-
using RubberduckTests.Mocks;
63
using Rubberduck.Inspections.Concrete;
74
using Rubberduck.Parsing.Inspections.Abstract;
85
using Rubberduck.Parsing.VBA;

RubberduckTests/Inspections/EmptyMethodInspectionTests.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System.Linq;
2-
using System.Threading;
32
using NUnit.Framework;
4-
using RubberduckTests.Mocks;
53
using Rubberduck.Inspections.Concrete;
64
using Rubberduck.VBEditor.SafeComWrappers;
75
using Rubberduck.Parsing.Inspections.Abstract;
@@ -131,14 +129,11 @@ public void EmptyMethod_DeclareStatement_NoResult()
131129

132130
private void CheckActualEmptyBlockCountEqualsExpected(string interfaceCode, string concreteCode, int expectedCount)
133131
{
134-
var builder = new MockVbeBuilder();
135-
var project = builder.ProjectBuilder("TestProject1", ProjectProtection.Unprotected)
136-
.AddComponent("IClass1", ComponentType.ClassModule, interfaceCode)
137-
.AddComponent("Class1", ComponentType.ClassModule, concreteCode)
138-
.Build();
139-
var vbe = builder.AddProject(project).Build().Object;
132+
var results = InspectionResultsForModules(
133+
("IClass1", interfaceCode, ComponentType.ClassModule),
134+
("Class1", concreteCode, ComponentType.ClassModule));
140135

141-
Assert.AreEqual(expectedCount, InspectionResults(vbe).Count());
136+
Assert.AreEqual(expectedCount, results.Count());
142137
}
143138

144139
protected override IInspection InspectionUnderTest(RubberduckParserState state)

RubberduckTests/Inspections/EmptyModuleInspectionTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Rubberduck.Parsing.Inspections.Abstract;
55
using Rubberduck.Parsing.VBA;
66
using Rubberduck.VBEditor.SafeComWrappers;
7-
using RubberduckTests.Mocks;
87

98
namespace RubberduckTests.Inspections
109
{
@@ -71,8 +70,7 @@ public void ModulesWithVariousContent_NoResults(string inputCode)
7170
[Category("Inspections")]
7271
public void EmptyDocumentModules_NoResults(string inputCode)
7372
{
74-
var vbe = MockVbeBuilder.BuildFromSingleModule(inputCode, ComponentType.Document, out _).Object;
75-
Assert.AreEqual(0, InspectionResults(vbe).Count());
73+
Assert.AreEqual(0, InspectionResultsForModules(("TestDoc", inputCode, ComponentType.Document)).Count());
7674
}
7775

7876
[Test]

RubberduckTests/Inspections/ExcelMemberMayReturnNothingInspectionTests.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Rubberduck.Parsing.Inspections.Abstract;
66
using Rubberduck.Parsing.VBA;
77
using Rubberduck.VBEditor.SafeComWrappers;
8-
using RubberduckTests.Mocks;
98

109
namespace RubberduckTests.Inspections
1110
{
@@ -222,16 +221,7 @@ End Sub
222221
}
223222

224223
private IEnumerable<IInspectionResult> InspectionResults(string inputCode)
225-
{
226-
var builder = new MockVbeBuilder();
227-
var project = builder.ProjectBuilder("VBAProject", ProjectProtection.Unprotected)
228-
.AddComponent("Module1", ComponentType.StandardModule, inputCode)
229-
.AddReference("Excel", MockVbeBuilder.LibraryPathMsExcel, 1, 8, true)
230-
.Build();
231-
232-
var vbe = builder.AddProject(project).Build();
233-
return InspectionResults(vbe.Object);
234-
}
224+
=> InspectionResultsForModules(("Module1", inputCode, ComponentType.StandardModule), "Excel");
235225

236226
protected override IInspection InspectionUnderTest(RubberduckParserState state)
237227
{

0 commit comments

Comments
 (0)