private void AddStyleProps(string styleId, CssClass cssClass) { if (styleId != null) { AddOrSet(cssClass, _stylePropsCache.Get(styleId)); return; } if (_defaultsProvider.DefaultParagraphStyle != null) { var props = _stylePropsCache.Get(_defaultsProvider.DefaultParagraphStyle); AddOrSet(cssClass, props); } }
private void AddRunStyle(CssClass cssClass, string styleId) { if (styleId != null) { cssClass.Props.AddMany(_rStylePropsCache.Get(styleId)); return; } if (_defaults.DefaultRunStyle != null) { var props = _rStylePropsCache.Get(_defaults.DefaultRunStyle); cssClass.Props.AddMany(props); } }
public void Build_ParagraphStyleTest() { string styleId = "p-style"; var rPr = new RunProperties(); var props = new CssPropertiesSet { new MockProp1(), new MockProp2() }; _pStylePropsCache.Get(styleId).Returns(props); var result = _instance.Build(new RunClassParam { ParagraphStyleId = styleId, InlineProperties = rPr, }); Utils.AssertDynamicClass(_nameGen.Prefix, result); Assert.IsTrue(props.Equals(result.Props)); }
private void MockStyleProps(string styleId, out RunProperties rPr, out CssPropertiesSet props) { rPr = new RunProperties { RunStyle = new RunStyle { Val = styleId } }; props = new CssPropertiesSet { new MockProp1(), new MockProp2() }; _rStylePropsCache.Get(styleId).Returns(props); }
private void MockStyleProps(string styleId, out ParagraphProperties pPr, out CssPropertiesSet props) { pPr = new ParagraphProperties { ParagraphStyleId = new ParagraphStyleId { Val = styleId } }; props = new CssPropertiesSet { new MockProp1(), new MockProp2() }; _propsFac.Build(Arg.Is(pPr)).Returns(new CssPropertiesSet()); _stylePropsCache.Get(styleId).Returns(props); }
public void Initialize() { _config = new StyleConfig(); _defaults = Substitute.For <IDefaultsProvider>(); _defaults.Run.Returns(new CssPropertiesSet()); _pStylePropsCache = Substitute.For <IStylePropsCache>(); _numPropsCache = Substitute.For <INumberingPropsCache>(); _rStylePropsCache = Substitute.For <IStylePropsCache>(); _rStylePropsCache.Get(Arg.Any <string>()).Returns(new CssPropertiesSet()); _propsFac = Substitute.For <ICssPropertiesFactory>(); _propsFac.Build(null).ReturnsForAnyArgs(x => new CssPropertiesSet()); _instance = new RunClassFactory( _config, new ClsNameGenerator(_config), _defaults, _pStylePropsCache, _numPropsCache, _rStylePropsCache, FacBuilder); }
public void Initialize() { _propsFac = Substitute.For <ICssPropertiesFactory>(); _propsFac .Build(Arg.Any <OpenXmlElement>()) .ReturnsForAnyArgs(x => new CssPropertiesSet()); _stylePropsCache = Substitute.For <IStylePropsCache>(); _stylePropsCache.Get(Arg.Any <string>()) .Returns(new CssPropertiesSet()); _numPropsCache = Substitute.For <INumberingPropsCache>(); _defaults = Substitute.For <IDefaultsProvider>(); _defaults.Paragraph.Returns(new CssPropertiesSet()); _nameGen = new NameGenerator() { Prefix = "d" }; _instance = new ParagraphClassFactory( _nameGen, _defaults, _stylePropsCache, _numPropsCache, _propsFac); }
public void Initialize() { _defaults = Substitute.For <IDefaultsProvider>(); _defaults.Run.Returns(new CssPropertiesSet()); _defaults.DefaultRunStyle.Returns(x => null); _defaults.DefaultParagraphStyle.Returns(x => null); _pStylePropsCache = Substitute.For <IStylePropsCache>(); _numPropsCache = Substitute.For <INumberingPropsCache>(); _rStylePropsCache = Substitute.For <IStylePropsCache>(); _rStylePropsCache.Get(Arg.Any <string>()).Returns(new CssPropertiesSet()); _propsFac = Substitute.For <ICssPropertiesFactory>(); _propsFac.Build(null).ReturnsForAnyArgs(x => new CssPropertiesSet()); _nameGen = new NameGenerator() { Prefix = "d" }; _instance = new RunClassFactory( _nameGen, _defaults, _pStylePropsCache, _numPropsCache, _rStylePropsCache, _propsFac); }