public void MergesIfNameEqual() { using (var temp = new TempDirectory()) { var comb = new MemorizedComb("comb", new FileMnemonic(temp.Value().FullName) ); comb.Cell("some-data") .Update(new InputOf("<some-data/>")); comb.Xocument("some-data") .Modify( new Directives() .Xpath("/some-data") .Add("newElement").Set("content") ); Assert.Equal( "1", comb.Xocument("_guts.xml") .Value("count(/items/item)", "0") ); } }
public void NormalizesName() { var comb = new MemorizedComb("name\\with/diff", new RamMnemonic()); Assert.Equal( "name/with/diff", comb.Name() ); }
public void HasProps() { var name = "name"; var comb = new MemorizedComb(name, new RamMnemonic()); comb.Props().Refined("testprop", "first"); Assert.Equal( "first", comb.Props().Value("testprop") ); }
public void GutsIncludeData() { var comb = new MemorizedComb("the name", new RamMnemonic()); comb.Cell("cell").Update(new InputOf("cool text")); var values = comb.Xocument("_guts.xml") .Values("/items/item/name/text()"); Assert.Single(new Filtered <string>((text) => text.Equals("cell"), values)); }
public void GutsIncludeXocuments() { var comb = new MemorizedComb("the name", new RamMnemonic()); comb.Xocument("xocument") .Modify( new Directives() .Xpath("xocument") .Add("root") .Set("also cool") ); var values = comb.Xocument("_guts.xml") .Values("/items/item/name/text()"); Assert.Single(new Filtered <string>((text) => text.Equals("xocument"), values)); }
public void MemorizesXml() { using (var temp = new TempDirectory()) { var mem = new FileMnemonic(temp.Value().FullName); using (var xoc = new MemorizedComb("beverage", mem).Xocument("coke.xml")) { xoc.Modify(new Directives().Xpath("/coke").Add("light").Set("yes please")); } mem = new FileMnemonic(temp.Value().FullName); using (var xoc = new MemorizedComb("beverage", mem).Xocument("coke.xml")) { Assert.Equal( "yes please", xoc.Value("/coke/light/text()", "") ); } } }
public void MemorizesBinary() { using (var temp = new TempDirectory()) { var mem = new FileMnemonic(temp.Value().FullName); using (var pepsi = new MemorizedComb("beverage", mem).Cell("pepsi")) { pepsi.Update(new InputOf("Empty")); } mem = new FileMnemonic(temp.Value().FullName); using (var pepsi = new MemorizedComb("beverage", mem).Cell("pepsi")) { Assert.Equal( "Empty", new TextOf( new InputOf(pepsi.Content()) ).AsString() ); } } }