private void AddTableStyle(CssClass cssClass, List <OpenXmlElement> tableProperties) { if (tableProperties == null || tableProperties.Count == 0) { return; } for (int i = tableProperties.Count - 1; i >= 0; i--) { var cssPropSet = _propsFac.Build(tableProperties[i]); cssClass.Props.AddMany(cssPropSet); } }
private void AddTableProps(List <OpenXmlElement> tableProperties, CssClass cssClass) { if (tableProperties == null || tableProperties.Count == 0) { return; } for (int i = tableProperties.Count - 1; i >= 0; i--) { var elem = tableProperties[i]; var props = _propsFac.Build(elem); AddOrSet(cssClass, props); } }
public void Paragraph_SomeTest() { var expected = new CssPropertiesSet { new MockProp1() }; _propsFac .Build(Arg.Is(PDefaults)) .Returns(expected); var result = _instance.Paragraph; Assert.IsTrue(expected.Equals(result)); }
private CssPropertiesSet BuildInline(OpenXmlElement pPr) { if (pPr == null) { return(new CssPropertiesSet()); } return(_propsFac.Build(pPr)); }
public override CssPropertiesSet BuildProps(WStyle style) { if (style.StyleParagraphProperties != null) { return(_propsFac.Build(style.StyleParagraphProperties)); } return(new CssPropertiesSet()); }
public void Build_DyncPropsTest() { var rPr = new RunProperties(); var props = new CssPropertiesSet { new MockProp1(), new MockProp2() }; _propsFac.Build(Arg.Is(rPr)).Returns(props); var result = _instance.Build(new RunClassParam { InlineProperties = rPr }); Utils.AssertDynamicClass(_config, result); Assert.IsTrue(props.Equals(result.Props)); }
public void Build_DynFromPropsTest() { var pPr = new ParagraphProperties(); var props = new CssPropertiesSet { new MockProp1(), new MockProp2() }; _propsFac.Build(Arg.Is(pPr)).Returns(props); var result = _instance.Build(new ParagraphClassParam { InlineProperties = pPr }); Utils.AssertDynamicClass(_nameGen.Prefix, result); Assert.IsTrue(props.Equals(result.Props)); }
public override CssPropertiesSet BuildPropertiesSet(Level arg) { if (arg.NumberingSymbolRunProperties == null) { return(new CssPropertiesSet()); } var set = new CssPropertiesSet(); set.AddMany(_propsFac.Build(arg.NumberingSymbolRunProperties)); return(set); }
private CssPropertiesSet MockFactory( string styleId, params ICssProperty[] props) { var style = _styles.First(x => x.StyleId == styleId); var set = new CssPropertiesSet(props); _propsFac .Build(style) .Returns(set); return(set); }
public override CssPropertiesSet BuildPropertiesSet(Level arg) { if (arg.PreviousParagraphProperties == null) { return(new CssPropertiesSet()); } var set = new CssPropertiesSet(); set.AddMany(_propsFac.Build(arg.PreviousParagraphProperties)); return(set); }
private CssPropertiesSet BuildInline(OpenXmlElement rProps) { var set = new CssPropertiesSet(); if (rProps == null) { return(set); } var props = _propsFac.Build(rProps); set.AddMany(props); return(set); }
public void Run_SomeTest() { var expected = new CssPropertiesSet { new MockProp1() }; _rPropsFac .Build(Arg.Is(RDefaults())) .Returns(expected); var result = _instance.Run; Assert.IsTrue(expected.Equals(result)); }
public void BuildPropsSet_Test() { var props = new CssPropertiesSet { new MockProp1() }; var level = new Level { PreviousParagraphProperties = new PreviousParagraphProperties() }; _propsFac .Build(Arg.Is(level.PreviousParagraphProperties)) .Returns(props); var result = _instance.BuildPropertiesSet(level); Assert.AreSame(props.Single(), result.Single()); }
public void BuildPropsSet_Test() { var props = new CssPropertiesSet { new MockProp1() }; var level = new Level { NumberingSymbolRunProperties = new NumberingSymbolRunProperties() }; _propsFac .Build(Arg.Is(level.NumberingSymbolRunProperties)) .Returns(props); var result = _instance.BuildPropertiesSet(level); Assert.AreSame(props.Single(), result.Single()); }
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); }
public override CssPropertiesSet BuildProps(WStyle style) => _propsFac.Build(style);