Skip to content

Commit

Permalink
Remove tests requiring us to load an external library
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosch250 committed Jun 7, 2016
1 parent 7123cac commit 961719f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,36 +173,6 @@ Sub IClass1_Foo(arg1 As Integer)
Assert.AreEqual(1, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ImplicitByRefParameter_DoesNotReturnResult_BuiltInEvent()
{
//Input
const string inputCode =
@"Private Sub UserForm_Zoom(Percent As Integer)
End Sub";

//Arrange
var builder = new MockVbeBuilder();
var project = builder.ProjectBuilder("TestProject1", vbext_ProjectProtection.vbext_pp_none)
.AddComponent("Class1", vbext_ComponentType.vbext_ct_MSForm, inputCode)
.Build();
var vbe = builder.AddProject(project).Build();

var mockHost = new Mock<IHostApplication>();
mockHost.SetupAllProperties();
var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

parser.Parse();
if (parser.State.Status >= ParserState.Error) { Assert.Inconclusive("Parser Error"); }

var inspection = new ImplicitByRefParameterInspection(parser.State);
var inspectionResults = inspection.GetInspectionResults();

Assert.AreEqual(0, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ImplicitByRefParameter_QuickFixWorks_PassByRef()
Expand Down
26 changes: 0 additions & 26 deletions RubberduckTests/Inspections/ParameterNotUsedInspectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,6 @@ public void ParameterUsed_DoesNotReturnResult()
Assert.AreEqual(0, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ParameterUsed_BuiltInEventHandlerParameter_DoesNotReturnResult()
{
const string inputCode =
@"Private Sub UserForm_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Control As MSForms.Control, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
End Sub";

//Arrange
var builder = new MockVbeBuilder();
VBComponent component;
var vbe = builder.BuildFromSingleModule(inputCode, vbext_ComponentType.vbext_ct_MSForm, out component, new Rubberduck.VBEditor.Selection());
var mockHost = new Mock<IHostApplication>();
mockHost.SetupAllProperties();
var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

parser.Parse();
if (parser.State.Status >= ParserState.Error) { Assert.Inconclusive("Parser Error"); }

var inspection = new ParameterNotUsedInspection(vbe.Object, parser.State, null);
var inspectionResults = inspection.GetInspectionResults();

Assert.AreEqual(0, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ParameterNotUsed_ReturnsResult_SomeParamsUsed()
Expand Down
30 changes: 0 additions & 30 deletions RubberduckTests/Inspections/ProcedureNotUsedInspectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,36 +194,6 @@ public void ProcedureNotUsed_DoesNotReturnResult_EventImplementation()
Assert.AreEqual(0, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ProcedureNotUsed_DoesNotReturnResult_BuiltInEventImplementation()
{
//Input
const string inputCode =
@"Private Sub UserForm_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Control As MSForms.Control, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
End Sub";

//Arrange
var builder = new MockVbeBuilder();
var project = builder.ProjectBuilder("TestProject1", vbext_ProjectProtection.vbext_pp_none)
.AddComponent("Form", vbext_ComponentType.vbext_ct_MSForm, inputCode)
.Build();
var vbe = builder.AddProject(project).Build();

var mockHost = new Mock<IHostApplication>();
mockHost.SetupAllProperties();
var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

parser.Parse();
if (parser.State.Status >= ParserState.Error) { Assert.Inconclusive("Parser Error"); }

var inspection = new ProcedureNotUsedInspection(parser.State);
var inspectionResults = inspection.GetInspectionResults();

Assert.AreEqual(0, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ProcedureNotUsed_NoResultForClassInitialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,42 +290,6 @@ public void ProcedureShouldBeFunction_DoesNotReturnResult_EventImplementation()
Assert.AreEqual(0, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ProcedureShouldBeFunction_DoesNotReturnResult_BuiltInEventImplementation()
{
//Input
const string inputCode =
@"Private Sub UserForm_Zoom(Percent As Integer)
End Sub";

//Arrange
var settings = new Mock<IGeneralConfigService>();
var config = GetTestConfig();
settings.Setup(x => x.LoadConfiguration()).Returns(config);

var builder = new MockVbeBuilder();
var project = builder.ProjectBuilder("TestProject1", vbext_ProjectProtection.vbext_pp_none)
.AddComponent("Class1", vbext_ComponentType.vbext_ct_MSForm, inputCode)
.Build();
var vbe = builder.AddProject(project).Build();

var mockHost = new Mock<IHostApplication>();
mockHost.SetupAllProperties();
var parser = MockParser.Create(vbe.Object, new RubberduckParserState());

parser.Parse();
if (parser.State.Status >= ParserState.Error) { Assert.Inconclusive("Parser Error"); }

var inspection = new ProcedureCanBeWrittenAsFunctionInspection(parser.State);
var inspector = new Inspector(settings.Object, new IInspection[] { inspection });

var inspectionResults = inspector.FindIssuesAsync(parser.State, CancellationToken.None).Result;

Assert.AreEqual(0, inspectionResults.Count());
}

[TestMethod]
[TestCategory("Inspections")]
public void ProcedureShouldBeFunction_QuickFixWorks()
Expand Down

0 comments on commit 961719f

Please sign in to comment.