public void StartNewBuild() { const String expected = "<fruits>" + "<apple>" + "</apple>" + "</fruits>"; builder = createOutputBuilder("orders"); builder.AddBelow("order"); builder.StartNewBuild("fruits"); builder.AddBelow("apple"); assertXMLEquals(expected, builder.ToString(), "start new build"); }
public void AddBesideAndAbove() { const String expected = "<orders>" + "<order>" + "<item/>" + "<item/>" + "<item/>" + "</order>" + "<order/>" + "</orders>"; builder = createOutputBuilder("orders"); builder.AddBelow("order"); builder.AddBelow("item"); builder.AddBeside("item"); builder.AddBeside("item"); builder.AddAbove("order"); assertXMLEquals(expected, builder.ToString(), "beside & above"); }
public void AddBelow() { const String expected = "<orders>" + "<order>" + "</order>" + "</orders>"; builder = createOutputBuilder("orders"); builder.AddBelow("order"); assertXMLEquals(expected, builder.ToString(), "built xml"); }
public void AddBelowWithAttribute() { const String expected = "<orders>" + "<order number='123'>" + "</order>" + "</orders>"; builder = createOutputBuilder("orders"); builder.AddBelow("order"); builder.AddAttribute("number", "123"); assertXMLEquals(expected, builder.ToString(), "built xml"); }
public void ValueAndChild() { const String expected = "<flavor>" + "this flavor is really good" + "<grape>" + "</grape>" + "</flavor>"; builder = createOutputBuilder("flavor"); builder.AddValue("this flavor is really good"); builder.AddBelow("grape"); assertXMLEquals(expected, builder.ToString(), "value and child"); }
public void AddAboveRoot() { var invalidResult = "<orders>" + "<order>" + "</order>" + "<customer>" + "<customer>"; this._builder = CreateBuilder("orders"); _builder.AddBelow("order"); try { _builder.AddAbove("customer"); throw new Exception("RuntimeException"); } catch (Exception e) { } }
public void TestAddAboveRoot() { string invalidResult = "<orders>" + "<order>" + "</order>" + "</orders>" + "<customer>" + "</customer>"; Builder = new DOMBuilder("orders"); Builder.AddBelow("order"); try { Builder.AddAbove("customer"); Fail("expecting RuntimeException"); } catch (RuntimeException ignored) { } }
public void TestAddAboveRoot() { builder = CreateBuilder("orders"); builder.AddBelow("order"); Assert.Throws <InvalidOperationException>(() => builder.AddAbove("customer")); }
public void AddAboveRoot() { builder = createOutputBuilder("orders"); builder.AddBelow("order"); builder.AddAbove("customer"); }