public RewriteSessionFactory(RubberduckParserState state, IRewriterProvider rewriterProvider, ISelectionRecoverer selectionRecoverer)
 {
     _state              = state;
     _rewriterProvider   = rewriterProvider;
     _selectionRecoverer = selectionRecoverer;
 }
 protected abstract IExecutableRewriteSession RewriteSession(IParseManager parseManager, Func <IRewriteSession, bool> rewritingAllowed, out MockRewriterProvider mockProvider, bool rewritersAreDirty = false, ISelectionRecoverer selectionRecoverer = null);
        protected IExecutableRewriteSession RewriteSession(Func <IRewriteSession, bool> rewritingAllowed,
                                                           out MockRewriterProvider mockProvider, bool rewritersAreDirty = false, ISelectionRecoverer selectionRecoverer = null)
        {
            var parseManager = new Mock <IParseManager>();

            parseManager.Setup(m => m.OnSuspendParser(It.IsAny <object>(), It.IsAny <IEnumerable <ParserState> >(), It.IsAny <Action>(), It.IsAny <int>()))
            .Callback((object requestor, IEnumerable <ParserState> allowedStates, Action suspendAction, int timeout) => suspendAction())
            .Returns((object requestor, IEnumerable <ParserState> allowedStates, Action suspendAction, int timeout) => new SuspensionResult(SuspensionOutcome.Completed));
            return(RewriteSession(parseManager.Object, rewritingAllowed, out mockProvider, rewritersAreDirty, selectionRecoverer));
        }
Exemplo n.º 4
0
 protected override IExecutableRewriteSession RewriteSession(IParseManager parseManager, Func <IRewriteSession, bool> rewritingAllowed, out MockRewriterProvider mockProvider, bool rewritersAreDirty = false, ISelectionRecoverer selectionRecoverer = null)
 {
     if (selectionRecoverer == null)
     {
         selectionRecoverer = new Mock <ISelectionRecoverer>().Object;
     }
     mockProvider = new MockRewriterProvider(rewritersAreDirty);
     return(new CodePaneRewriteSession(parseManager, mockProvider, selectionRecoverer, rewritingAllowed));
 }
 public AttributesRewriteSession(IParseManager parseManager, IRewriterProvider rewriterProvider, ISelectionRecoverer selectionRecoverer,
                                 Func <IRewriteSession, bool> rewritingAllowed)
     : base(rewriterProvider, selectionRecoverer, rewritingAllowed)
 {
     _parseManager = parseManager;
 }
Exemplo n.º 6
0
 protected RewriteSessionBase(IRewriterProvider rewriterProvider, ISelectionRecoverer selectionRecoverer, Func <IRewriteSession, bool> rewritingAllowed)
 {
     RewriterProvider   = rewriterProvider;
     _rewritingAllowed  = rewritingAllowed;
     SelectionRecoverer = selectionRecoverer;
 }