public void LoopNoBody() { var tag = new ForEach(); tag.Items = new MockAttribute(new Property("AList")); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(String.Empty)); }
public void LoopWithSimpleBody() { var tag = new ForEach(); tag.Items = new MockAttribute(new Property("AList")); tag.Body = new MockAttribute(new Property("Body")); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(Body + Body + Body + Body + Body + Body + Body)); }
public void LoopWithComplexStatusBody() { var tag = new ForEach(); tag.Items = new MockAttribute(new Property("AList")); tag.Body = new TemplateAttribute(new Formatter(ComplexStatusBody).Parse().ParsedTemplate); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo("[0/7][1/7][2/7][3/7][4/7][5/7][6/7]")); }
public void LoopNoBody() { var tag = new ForEach(); tag.Select = new MockAttribute(new Constant("//value")); tag.Source = new MockAttribute(new Constant("xml")); Assert.That(tag.Evaluate(_model), Is.EqualTo(String.Empty)); }
public void LoopWithStepAndBodyWithFilterInSelect() { var tag = new ForEach(); tag.Select = new MockAttribute(new Constant("//value[@flag=\"uppercase\"]")); tag.Source = new MockAttribute(new Constant("xml")); tag.Body = new TemplateAttribute(new Formatter("<x:out source=\"Item\" select=\".\"/>").Parse().ParsedTemplate); Assert.That(tag.Evaluate(_model), Is.EqualTo("ACEGIKMOQSUWY")); }
public void LoopWithEvaluatingBody() { var tag = new ForEach(); tag.Select = new MockAttribute(new Constant("//value")); tag.Source = new MockAttribute(new Constant("xml")); tag.Body = new TemplateAttribute(new Formatter("<x:out source=\"Item\" select=\".\"/>").Parse().ParsedTemplate); Assert.That(tag.Evaluate(_model), Is.EqualTo("AbCdEfGhIjKlMnOpQrStUvWxYz")); }
public void LoopWithComplexStatusBody() { var tag = new ForEach(); tag.Select = new MockAttribute(new Constant("//value")); tag.Source = new MockAttribute(new Constant("xml")); tag.End = new MockAttribute(new Constant("7")); tag.Body = new TemplateAttribute(new Formatter("[${Status.Index}/${Status.Count}]").Parse().ParsedTemplate); Assert.That(tag.Evaluate(_model), Is.EqualTo("[0/26][1/26][2/26][3/26][4/26][5/26][6/26]")); }
public void LoopWithFirstEndAndStepComplexBody() { var tag = new ForEach(); tag.Items = new MockAttribute(new Property("AList")); tag.Begin = new MockAttribute(new Constant("1")); tag.End = new MockAttribute(new Constant("6")); tag.Step = new MockAttribute(new Constant("2")); tag.Body = new TemplateAttribute(new Formatter(ComplexBody).Parse().ParsedTemplate); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo("[2][4][6]")); }
public void LoopWithStepAndBeginBody() { var tag = new ForEach(); tag.Select = new MockAttribute(new Constant("//value")); tag.Source = new MockAttribute(new Constant("xml")); tag.Body = new TemplateAttribute(new Formatter("<x:out source=\"Item\" select=\".\"/>").Parse().ParsedTemplate); tag.Begin = new MockAttribute(new Constant("13")); tag.Step = new MockAttribute(new Constant("2")); Assert.That(tag.Evaluate(_model), Is.EqualTo("nprtvxz")); }