public void Initialize() { _cssRegistrator = Substitute.For <ICssRegistrator>(); _styleConveter = Substitute.For <IStyleConverter>(); _styleConveter.BuildRegistrator().Returns(_cssRegistrator); _config = new StyleConfig(); _instance = new StylePlugin(_styleConveter, _config); _css = new StringBuilder(); _state = Substitute.For <IProcessingState>(); _state.Css.Returns(_css); _state.Elements.Returns(_ => new ElementProcessingState[0]); _state.GetContext(out ICssRegistrator _) .Returns(x => { x[0] = _cssRegistrator; return(true); }); _parentVNode = new VNode(); _currentVNode = new VNode(); _elemState = Substitute.For <IElementProcessingState>(); _elemState.ProcessingState.Returns(_state); _elemState .GetContext(out ParagraphContext _) .Returns(x => { x[0] = new ParagraphContext { Parent = _parentVNode }; return(true); }); _elemState.CurrentVNode.Returns(_ => _currentVNode); }
public void PreProcess(IProcessingState state) { state.SetContext(_styleConverter.BuildRegistrator()); }