Exemple #1
0
        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 <IAnnotateDeclarationPresenter, AnnotateDeclarationModel>(factory, uiDispatcherMock.Object);

            var annotationUpdater         = new AnnotationUpdater(state);
            var attributesUpdater         = new AttributesUpdater(state);
            var annotateDeclarationAction = new AnnotateDeclarationRefactoringAction(rewritingManager, annotationUpdater, attributesUpdater);

            var selectedDeclarationProvider = new SelectedDeclarationProvider(selectionService, state);

            var refactoring = new AnnotateDeclarationRefactoring(annotateDeclarationAction, selectedDeclarationProvider, selectionService, userInteraction);
            var notifier    = new AnnotateDeclarationFailedNotifier(msgBox);

            return(new AnnotateSelectedMemberCommand(refactoring, notifier, selectionService, state, state, selectedDeclarationProvider));
        }
 public AnnotateSelectedMemberCommand(
     AnnotateDeclarationRefactoring refactoring,
     AnnotateDeclarationFailedNotifier failureNotifier,
     ISelectionProvider selectionProvider,
     IParserStatusProvider parserStatusProvider,
     RubberduckParserState state,
     ISelectedDeclarationProvider selectedDeclarationProvider)
     : base(refactoring, failureNotifier, selectionProvider, parserStatusProvider, state)
 {
     _selectedDeclarationProvider = selectedDeclarationProvider;
 }
        protected AnnotateDeclarationCodePaneCommandBase(
            AnnotateDeclarationRefactoring refactoring,
            AnnotateDeclarationFailedNotifier failureNotifier,
            ISelectionProvider selectionProvider,
            IParserStatusProvider parserStatusProvider,
            RubberduckParserState state)
            : base(refactoring, failureNotifier, selectionProvider, parserStatusProvider)
        {
            _state = state;

            AddToCanExecuteEvaluation(SpecializedEvaluateCanExecute);
        }