public void RejectsDuplicateKeyForArray() { IMedia <XNode> media = new XmlMedia(); media.Array("array", "item"); Assert.Throws <InvalidOperationException>(() => media.Array("array", "item") ); }
public void CreatesArrayAtRoot() { var media = new XmlMedia(); media.Array("root", "key"); Assert.Equal( "<root />", media.Content().ToString() ); }
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 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) ); }