@@ -221,19 +221,18 @@ public void RemoveParametersRefactoring_RemoveFromGetter()
221
221
Assert . AreEqual ( expectedCode , Module . Object . Lines ( ) ) ;
222
222
}
223
223
224
- //bug: We shouldn't allow the only param in a setter to be removed, it will break the VBA code.
225
224
[ TestMethod ]
226
225
public void RemoveParametersRefactoring_RemoveFromSetter ( )
227
226
{
228
227
//Input
229
228
const string inputCode =
230
- @"Private Property Set Foo(ByVal arg1 As Integer)
229
+ @"Private Property Set Foo(ByVal arg1 As Integer)
231
230
End Property" ;
232
231
var selection = new Selection ( 1 , 23 , 1 , 27 ) ; //startLine, startCol, endLine, endCol
233
232
234
233
//Expectation
235
234
const string expectedCode =
236
- @"Private Property Set Foo()
235
+ @"Private Property Set Foo(ByVal arg1 As Integer )
237
236
End Property" ; //note: The IDE strips out the extra whitespace
238
237
239
238
//Arrange
@@ -257,20 +256,23 @@ public void RemoveParametersRefactoring_RemoveFromSetter()
257
256
Assert . AreEqual ( expectedCode , Module . Object . Lines ( ) ) ;
258
257
}
259
258
259
+ // todo: write a test that confirms that Property Set and Property Let members have 1 less parameter than what the signature actually says.
260
+ // ...or re-implement the code so that such a test isn't needed to document this surprising behavior.
261
+
260
262
//note: removing other params from setters is fine (In fact, we may want to create an inspection for this).
261
263
[ TestMethod ]
262
264
public void RemoveParametersRefactoring_RemoveSecondParamFromSetter ( )
263
265
{
264
266
//Input
265
267
const string inputCode =
266
- @"Private Property Set Foo(ByVal arg1 As Integer, ByVal arg2 As String)
268
+ @"Private Property Set Foo(ByVal arg1 As Integer, ByVal arg2 As String)
267
269
End Property" ;
268
270
var selection = new Selection ( 1 , 23 , 1 , 27 ) ; //startLine, startCol, endLine, endCol
269
271
270
272
//Expectation
271
273
const string expectedCode =
272
- @"Private Property Set Foo(ByVal arg1 As Integer )
273
- End Property" ; //note: The IDE strips out the extra whitespace
274
+ @"Private Property Set Foo( ByVal arg2 As String )
275
+ End Property" ; //note: The IDE strips out the extra whitespace // bug: the refactoring should be removing that extra whitespace.
274
276
275
277
//Arrange
276
278
SetupProject ( inputCode ) ;
@@ -280,7 +282,7 @@ public void RemoveParametersRefactoring_RemoveSecondParamFromSetter()
280
282
281
283
//Specify Param(s) to remove
282
284
var model = new RemoveParametersModel ( parseResult , qualifiedSelection ) ;
283
- model . Parameters [ 1 ] . IsRemoved = true ;
285
+ model . Parameters [ 0 ] . IsRemoved = true ;
284
286
285
287
//SetupFactory
286
288
var factory = SetupFactory ( model ) ;
0 commit comments