public void TestCat2AttributesWithApply() { ST e = new ST( "<[names,phones]:{a|<a>.}>" ); e.Add("names", "Ter"); e.Add("names", "Tom"); e.Add("phones", "1"); e.Add("phones", "2"); String expecting = "Ter.Tom.1.2."; Assert.AreEqual(expecting, e.Render()); }
public void TestCat2Attributes() { ST e = new ST( "<[names,phones]; separator=\", \">" ); e.Add("names", "Ter"); e.Add("names", "Tom"); e.Add("phones", "1"); e.Add("phones", "2"); String expecting = "Ter, Tom, 1, 2"; Assert.AreEqual(expecting, e.Render()); }
public void TestCatWithIFAsElement() { ST e = new ST( "<[{<if(names)>doh<endif>},phones]; separator=\", \">" ); e.Add("names", "Ter"); e.Add("names", "Tom"); e.Add("phones", "1"); e.Add("phones", "2"); String expecting = "doh, 1, 2"; Assert.AreEqual(expecting, e.Render()); }
public void TestJustCat() { ST e = new ST( "<[names,phones]>" ); e.Add("names", "Ter"); e.Add("names", "Tom"); e.Add("phones", "1"); e.Add("phones", "2"); String expecting = "TerTom12"; Assert.AreEqual(expecting, e.Render()); }
public void TestCatWithTemplateApplicationAsElement() { ST e = new ST( "<[names:{<it>!},phones]; separator=\", \">" ); e.Add("names", "Ter"); e.Add("names", "Tom"); e.Add("phones", "1"); e.Add("phones", "2"); String expecting = "Ter!, Tom!, 1, 2"; Assert.AreEqual(expecting, e.Render()); }
public void TestCatWithNullTemplateApplicationAsElement() { ST e = new ST( "<[names:{<it>!},\"foo\"]:{x}; separator=\", \">" ); e.Add("phones", "1"); e.Add("phones", "2"); String expecting = "x"; // only one since template application gives nothing Assert.AreEqual(expecting, e.Render()); }