Exemple #1
0
        //The only relevant test is in the base class.

        protected override CommandBase TestCommand(
            IVBE vbe,
            RubberduckParserState state,
            IRewritingManager rewritingManager,
            ISelectionService selectionService)
        {
            var factory = new Mock <IRefactoringPresenterFactory>().Object;
            var msgBox  = new Mock <IMessageBox>().Object;

            var uiDispatcherMock = new Mock <IUiDispatcher>();

            uiDispatcherMock
            .Setup(m => m.Invoke(It.IsAny <Action>()))
            .Callback((Action action) => action.Invoke());
            var userInteraction = new RefactoringUserInteraction <IMoveMultipleFoldersPresenter, MoveMultipleFoldersModel>(factory, uiDispatcherMock.Object);

            var annotationUpdater         = new AnnotationUpdater(state);
            var moveToFolderAction        = new MoveToFolderRefactoringAction(rewritingManager, annotationUpdater);
            var changeFolderAction        = new ChangeFolderRefactoringAction(rewritingManager, moveToFolderAction);
            var moveFolderAction          = new MoveFolderRefactoringAction(rewritingManager, changeFolderAction);
            var moveMultipleFoldersAction = new MoveMultipleFoldersRefactoringAction(rewritingManager, moveFolderAction);

            var selectedDeclarationProvider = new SelectedDeclarationProvider(selectionService, state);

            var refactoring = new MoveContainingFolderRefactoring(moveMultipleFoldersAction, selectedDeclarationProvider, selectionService, userInteraction, state, state);
            var notifier    = new MoveContainingFolderRefactoringFailedNotifier(msgBox);

            return(new CodePaneRefactorMoveContainingFolderCommand(refactoring, notifier, selectionService, state, selectedDeclarationProvider));
        }
        public CodePaneRefactorMoveContainingFolderCommand(
            MoveContainingFolderRefactoring refactoring,
            MoveContainingFolderRefactoringFailedNotifier failureNotifier,
            ISelectionProvider selectionProvider,
            RubberduckParserState state,
            ISelectedDeclarationProvider selectedDeclarationProvider)
            : base(refactoring, failureNotifier, selectionProvider, state)
        {
            _selectedDeclarationProvider = selectedDeclarationProvider;
            _state = state;

            AddToCanExecuteEvaluation(SpecializedEvaluateCanExecute);
        }