예제 #1
0
        public void Initialize()
        {
            _config          = new TextProcessorConfig();
            _numberingConfig = new NumberingConfig();
            _instance        = new TextProcessorPlugin(_config);
            _r = new Run(new Text("Some text."));
            _p = new Paragraph(new ParagraphProperties(), _r);
            _nestingHandler = Substitute.For <IContextNestingHandler>();
            _cssRegistrator = Substitute.For <ICssRegistrator>();
            _globalContext  = Substitute.For <IGlobalContext>();
            _globalContext.TryResolve(out ICssRegistrator val1).Returns(x => {
                x[0] = _cssRegistrator;
                return(true);
            });
            _globalContext.TryResolve(out NumberingConfig val2).Returns(x =>
            {
                x[0] = _numberingConfig;
                return(true);
            });
            _cssRegistrator.RegisterParagraph(null, null).ReturnsForAnyArgs(x => new CssClass());
            _cssRegistrator.RegisterRun(null, null, null).ReturnsForAnyArgs(x => new CssClass());

            _pContext = new RootElementContext(_globalContext, _p)
            {
                NestingHandler = _nestingHandler
            };
            _rContext = new ChildElementContext(_pContext)
            {
                Element = _r
            };
        }
예제 #2
0
 public void Initialize()
 {
     _config = new TextProcessorConfig()
     {
         ParagraphCls = "pcls",
         HyperLinkCls = "hcls",
         RunCls       = "rcls"
     };
     _instance     = new TextProcessorPlugin(_config);
     _state        = Substitute.For <IProcessingState>();
     _elementState = Substitute.For <IElementProcessingState>();
     _elementState.CurrentVNode.Returns(new VNode("div"));
     _elementState
     .When(x => x.CurrentVNode = Arg.Any <VNode>())
     .Do(x => _currentNode     = x.Arg <VNode>());
 }