public RefactorEncapsulateFieldCommand(
            EncapsulateFieldRefactoring refactoring,
            EncapsulateFieldFailedNotifier encapsulateFieldFailedNotifier,
            RubberduckParserState state,
            ISelectionProvider selectionProvider,
            ISelectedDeclarationProvider selectedDeclarationProvider)
            : base(refactoring, encapsulateFieldFailedNotifier, selectionProvider, state)
        {
            _state = state;
            _selectedDeclarationProvider = selectedDeclarationProvider;

            AddToCanExecuteEvaluation(SpecializedEvaluateCanExecute);
        }
Пример #2
0
        protected override CommandBase TestCommand(IVBE vbe, RubberduckParserState state, IRewritingManager rewritingManager, ISelectionService selectionService)
        {
            var msgBox  = new Mock <IMessageBox>().Object;
            var factory = new Mock <IRefactoringPresenterFactory>().Object;
            var selectedDeclarationProvider = new SelectedDeclarationProvider(selectionService, state);
            var uiDispatcherMock            = new Mock <IUiDispatcher>();

            uiDispatcherMock
            .Setup(m => m.Invoke(It.IsAny <Action>()))
            .Callback((Action action) => action.Invoke());
            var refactoring = new EncapsulateFieldRefactoring(state, null, factory, rewritingManager, selectionService, selectedDeclarationProvider, uiDispatcherMock.Object);
            var notifier    = new EncapsulateFieldFailedNotifier(msgBox);
            var selectedDeclarationService = new SelectedDeclarationProvider(selectionService, state);

            return(new RefactorEncapsulateFieldCommand(refactoring, notifier, state, selectionService, selectedDeclarationService));
        }