public void CreatesArrayAtRoot() { var media = new XmlMedia(); media.Array("root", "key"); Assert.Equal( "<root />", media.Content().ToString() ); }
public void BuildsBlockInBlock() { var media = new XmlMedia(); media.Block("root") .Block("contents"); Assert.Equal( "<root><contents /></root>", media.Content().ToString(SaveOptions.DisableFormatting) ); }
public void WritesArray() { var media = new XmlMedia(); new BxArray("ItemArray", "Item", new ManyOf <string>("Entry")) .Print(media); Assert.Equal( "<ItemArray><Item>Entry</Item></ItemArray>", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }
public void DoesntPrintIfConditionNotMatched() { var media = new XmlMedia().Block("root"); new BxConditional(() => false, () => new BxProp("Matched", "true") ).Print(media); Assert.Equal( "<root />", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }
public void WritesBlockName() { var media = new XmlMedia(); new BxBlock("mein-block", new BxProp("stockwerk", "16")) .Print(media); Assert.Equal( "<mein-block><stockwerk>16</stockwerk></mein-block>", media.Content().ToString(SaveOptions.DisableFormatting) ); }
public void PrintsProp() { var media = new XmlMedia().Block("root"); new BxProp("Key", "Value") .Print(media); Assert.Equal( "<root><Key>Value</Key></root>", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }
public void CreatesPropertyInBlock() { var media = new XmlMedia(); media.Block("root") .Prop("key"); Assert.Equal( "1", new XMLCursor(media.Content()).Values("count(/root/key)")[0] ); }
public void PrintsIfConditionMatched() { var media = new XmlMedia().Block("root"); new BxConditional(() => true, () => new BxProp("Matched", "true") ).Print(media); Assert.Equal( "<root><Matched>true</Matched></root>", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }
public void PutsValueToProp() { var media = new XmlMedia(); media.Block("root") .Prop("key") .Put("lock"); Assert.Equal( "lock", new XMLCursor(media.Content()).Values("/root/key/text()")[0] ); }
public void CreatesBlockInRoot() { var media = new XmlMedia(); media.Block("root") .Prop("key") .Put("value"); Assert.Contains( "value", new XMLCursor(media.Content()).Values("/root/key/text()") ); }
public void PutsValueToArray() { var media = new XmlMedia(); media .Array("items", "item") .Put("ei"); Assert.Contains( "ei", new XMLCursor(media.Content()).Values("/items/item/text()")[0] ); }
public void CreatesArrayInArray() { var media = new XmlMedia(); media .Array("keys", "key") .Array("subarray", "subkey"); Assert.Equal( "<keys><subarray /></keys>", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }
public void CreatesArrayInBlock() { var media = new XmlMedia(); media .Block("root") .Array("keys", "key"); Assert.Equal( "<root><keys /></root>", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }
public void WritesBlockArrayUnnamed() { var media = new XmlMedia(); new BxBlockArray("H-Blockx", "H-Item", new BxBlock(new BxProp("move", "ya")), new BxBlock(new BxProp("move-move", "ya")) ).Print(media); Assert.Equal( "<H-Blockx><H-Item><move>ya</move></H-Item><H-Item><move-move>ya</move-move></H-Item></H-Blockx>", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }
public void CreatesBlockInProp() { var media = new XmlMedia(); media.Block("root") .Prop("my-block") .Block("contents"); Assert.Contains( "1", new XMLCursor(media.Content()) .Values("count(/root/my-block/contents)") ); }
public void CreatesBlockInArray() { var media = new XmlMedia(); media.Array("array", "item") .Block("item") .Prop("prop") .Put("eller"); Assert.Equal( "<array><item><prop>eller</prop></item></array>", media.Content().ToString(SaveOptions.DisableFormatting) ); }
public void PrintsBrix() { var media = new XmlMedia().Block("root"); new BxChain( new BxProp("firstname", "John"), new BxProp("lastname", "Malkovich") ) .Print(media); Assert.Equal( "<root><firstname>John</firstname><lastname>Malkovich</lastname></root>", media.Content().ToString(SaveOptions.DisableFormatting) ); }
public void WritesProps() { var media = new XmlMedia().Block("map"); new BxMap( new MapOf( "firstname", "Förster", "lastname", "Laster" ) ).Print(media); Assert.Equal( "<map><firstname>Förster</firstname><lastname>Laster</lastname></map>", media.Content().ToString(System.Xml.Linq.SaveOptions.DisableFormatting) ); }