Пример #1
0
        public RefactorExtractInterfaceCommand(
            ExtractInterfaceRefactoring refactoring,
            ExtractInterfaceFailedNotifier extractInterfaceFailedNotifier,
            RubberduckParserState state,
            ISelectionProvider selectionProvider)
            : base(refactoring, extractInterfaceFailedNotifier, selectionProvider, state)
        {
            _state = state;
            _extractInterfaceRefactoring = refactoring;

            AddToCanExecuteEvaluation(SpecializedEvaluateCanExecute);
        }
 public CodeExplorerExtractInterfaceCommand(
     ExtractInterfaceRefactoring refactoring,
     RubberduckParserState state,
     ExtractInterfaceFailedNotifier failureNotifier,
     IVbeEvents vbeEvents)
     : base(vbeEvents)
 {
     _state           = state;
     _refactoring     = refactoring;
     _failureNotifier = failureNotifier;
     AddToCanExecuteEvaluation(SpecialEvaluateCanExecute);
     AddToOnExecuteEvaluation(FurtherCanExecuteEvaluation);
 }
        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 refactoring = new ExtractInterfaceRefactoring(state, state, factory, rewritingManager, selectionService, uiDispatcherMock.Object);
            var notifier    = new ExtractInterfaceFailedNotifier(msgBox);

            return(new RefactorExtractInterfaceCommand(refactoring, notifier, state, selectionService));
        }
        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 addImplementationsBaseRefactoring = new AddInterfaceImplementationsRefactoringAction(rewritingManager, new CodeBuilder());
            var addComponentService = TestAddComponentService(state.ProjectsProvider);
            var baseRefactoring     = new ExtractInterfaceRefactoringAction(addImplementationsBaseRefactoring, state, state, rewritingManager, state.ProjectsProvider, addComponentService);
            var userInteraction     = new RefactoringUserInteraction <IExtractInterfacePresenter, ExtractInterfaceModel>(factory, uiDispatcherMock.Object);
            var refactoring         = new ExtractInterfaceRefactoring(baseRefactoring, state, userInteraction, selectionService, new CodeBuilder());
            var notifier            = new ExtractInterfaceFailedNotifier(msgBox);

            return(new RefactorExtractInterfaceCommand(refactoring, notifier, state, selectionService));
        }