4
4
using System . Windows . Forms ;
5
5
using Microsoft . VisualStudio . TestTools . UnitTesting ;
6
6
using Moq ;
7
+ using Rubberduck . Parsing . Symbols ;
7
8
using Rubberduck . Parsing . VBA ;
8
9
using Rubberduck . Refactorings ;
9
10
using Rubberduck . Refactorings . RemoveParameters ;
@@ -539,20 +540,19 @@ public void RemoveParametersRefactoring_RemoveFromGetter()
539
540
public void RemoveParametersRefactoring_QuickFix ( )
540
541
{
541
542
//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)
544
545
End Property" ;
545
- var selection = new Selection ( 1 , 38 , 1 , 38 ) ;
546
546
547
547
//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)
550
550
End Property" ;
551
551
552
552
//Arrange
553
553
var builder = new MockVbeBuilder ( ) ;
554
554
IVBComponent component ;
555
- var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component , selection ) ;
555
+ var vbe = builder . BuildFromSingleStandardModule ( inputCode , out component ) ;
556
556
var module = component . CodeModule ;
557
557
var mockHost = new Mock < IHostApplication > ( ) ;
558
558
mockHost . SetupAllProperties ( ) ;
@@ -561,7 +561,11 @@ public void RemoveParametersRefactoring_QuickFix()
561
561
parser . Parse ( new CancellationTokenSource ( ) ) ;
562
562
if ( parser . State . Status >= ParserState . Error ) { Assert . Inconclusive ( "Parser Error" ) ; }
563
563
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 ;
565
569
566
570
//Specify Param(s) to remove
567
571
var model = new RemoveParametersModel ( parser . State , qualifiedSelection , null ) ;
0 commit comments