Пример #1
0
        protected override IRefactoring TestRefactoring(
            IRewritingManager rewritingManager,
            RubberduckParserState state,
            RefactoringUserInteraction <IExtractInterfacePresenter, ExtractInterfaceModel> userInteraction,
            ISelectionService selectionService)
        {
            var addImplementationsBaseRefactoring = new AddInterfaceImplementationsRefactoringAction(rewritingManager, new CodeBuilder());
            var addComponentService = TestAddComponentService(state?.ProjectsProvider);
            var baseRefactoring     = new ExtractInterfaceRefactoringAction(addImplementationsBaseRefactoring, state, state, rewritingManager, state?.ProjectsProvider, addComponentService);

            return(new ExtractInterfaceRefactoring(baseRefactoring, state, userInteraction, selectionService, new CodeBuilder()));
        }
        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));
        }