public void ReorderParametersRefactoring_ParamArrayBeforeOtherArgument_CannotConfirmDialog() { //Input const string inputCode = @"Sub Foo(ByVal arg1 As String, ParamArray arg2()) End Sub Public Sub Goo(ByVal arg1 As Integer, _ ByVal arg2 As Integer, _ ByVal arg3 As Integer, _ ByVal arg4 As Integer, _ ByVal arg5 As Integer, _ ByVal arg6 As Integer) Foo ""test"", test1x, test2x, test3x, test4x, test5x, test6x End Sub "; var selection = new Selection(1, 23, 1, 27); ReorderParametersModel capturedModel = null; Func <ReorderParametersModel, ReorderParametersModel> presenterAction = model => { capturedModel = model; return(ReverseParameters()(model)); }; RefactoredCode(inputCode, selection, presenterAction); var declarationFinderProvider = new Mock <IDeclarationFinderProvider>().Object; var viewModel = new ReorderParametersViewModel(declarationFinderProvider, capturedModel); Assert.IsFalse(viewModel.OkButtonCommand.CanExecute(null)); }
public void ReorderParams_MoveOptionalParamBeforeNonOptionalParam_CannotConfirmDialog() { //Input const string inputCode = @"Private Sub Foo(ByVal arg1 As Integer, Optional ByVal arg2 As String, Optional ByVal arg3 As Boolean = True) End Sub"; var selection = new Selection(1, 23, 1, 27); ReorderParametersModel capturedModel = null; Func <ReorderParametersModel, ReorderParametersModel> presenterAction = model => { capturedModel = model; return(ReorderParamIndices(new List <int> { 1, 2, 0 })(model)); }; RefactoredCode(inputCode, selection, presenterAction); var declarationFinderProvider = new Mock <IDeclarationFinderProvider>().Object; var viewModel = new ReorderParametersViewModel(declarationFinderProvider, capturedModel); Assert.IsFalse(viewModel.OkButtonCommand.CanExecute(null)); }