Skip to content

Commit 2f021db

Browse files
committed
fixed broken test
1 parent 94397a0 commit 2f021db

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

RubberduckTests/Refactoring/RemoveParametersTests.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Windows.Forms;
55
using Microsoft.VisualStudio.TestTools.UnitTesting;
66
using Moq;
7+
using Rubberduck.Parsing.Symbols;
78
using Rubberduck.Parsing.VBA;
89
using Rubberduck.Refactorings;
910
using Rubberduck.Refactorings.RemoveParameters;
@@ -539,20 +540,19 @@ public void RemoveParametersRefactoring_RemoveFromGetter()
539540
public void RemoveParametersRefactoring_QuickFix()
540541
{
541542
//Input
542-
const string inputCode =
543-
@"Private Property Set Foo(ByVal arg1 As Integer, ByVal arg2 As String)
543+
const string inputCode = @"
544+
Private Property Set Foo(ByVal arg1 As Integer, ByVal arg2 As String)
544545
End Property";
545-
var selection = new Selection(1, 38, 1, 38);
546546

547547
//Expectation
548-
const string expectedCode =
549-
@"Private Property Set Foo(ByVal arg2 As String)
548+
const string expectedCode = @"
549+
Private Property Set Foo(ByVal arg2 As String)
550550
End Property";
551551

552552
//Arrange
553553
var builder = new MockVbeBuilder();
554554
IVBComponent component;
555-
var vbe = builder.BuildFromSingleStandardModule(inputCode, out component, selection);
555+
var vbe = builder.BuildFromSingleStandardModule(inputCode, out component);
556556
var module = component.CodeModule;
557557
var mockHost = new Mock<IHostApplication>();
558558
mockHost.SetupAllProperties();
@@ -561,7 +561,11 @@ public void RemoveParametersRefactoring_QuickFix()
561561
parser.Parse(new CancellationTokenSource());
562562
if (parser.State.Status >= ParserState.Error) { Assert.Inconclusive("Parser Error"); }
563563

564-
var qualifiedSelection = new QualifiedSelection(new QualifiedModuleName(component), selection);
564+
var parameter = parser.State.AllUserDeclarations.SingleOrDefault(p =>
565+
p.DeclarationType == DeclarationType.Parameter && p.IdentifierName == "arg1");
566+
if (parameter == null) { Assert.Inconclusive("Can't find 'arg1' parameter/target."); }
567+
568+
var qualifiedSelection = parameter.QualifiedSelection;
565569

566570
//Specify Param(s) to remove
567571
var model = new RemoveParametersModel(parser.State, qualifiedSelection, null);

0 commit comments

Comments
 (0)