public void LoopWithMultiDelimiterStringButSingleDelimterDelimiter() { var tag = new ForTokens(); tag.Items = new MockAttribute(new Constant("1,2.3,4.5,6.7")); tag.Delims = new MockAttribute(new Property("Delimeter")); tag.Body = new TemplateAttribute(new Formatter(ComplexBody).Parse().ParsedTemplate); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo("[1][2.3][4.5][6.7]")); }
public void LoopWithStepAndSimpleBody() { var tag = new ForTokens(); tag.Items = new MockAttribute(new Property("AList")); tag.Delims = new MockAttribute(new Property("Delimeter")); tag.Body = new MockAttribute(new Property("Body")); tag.Step = new MockAttribute(new Constant("2")); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(Body + Body + Body + Body)); }
public void LoopWithMultiDelimiterStringAndMultiDelimiter() { var tag = new ForTokens(); tag.Items = new MockAttribute(new Constant("1,2.3,4.5,6.7")); tag.Delims = new MockAttribute(new Constant(",.")); tag.Body = new TemplateAttribute(new Formatter(ComplexBody).Parse().ParsedTemplate); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo("[1][2][3][4][5][6][7]")); }
public void LoopWithFirstEndAndStepComplexBody() { var tag = new ForTokens(); tag.Items = new MockAttribute(new Property("AList")); tag.Delims = new MockAttribute(new Property("Delimeter")); 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 LoopWithComplexStatusBody() { var tag = new ForTokens(); tag.Items = new MockAttribute(new Property("AList")); tag.Delims = new MockAttribute(new Property("Delimeter")); 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 ForTokens(); tag.Items = new MockAttribute(new Property("AList")); tag.Delims = new MockAttribute(new Property("Delimeter")); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(String.Empty)); }
public void CheckRequired() { var tag = new ForTokens(); try { RequiredAttribute.Check(tag); Assert.Fail("Expected exception"); } catch (TagException Te) { Assert.That(Te.Message, Is.EqualTo( TagException.MissingRequiredAttribute(typeof (ForTokens), "Items", "Delims").Message)); } tag.Items = new MockAttribute(new Property("AList")); tag.Delims = new MockAttribute(new Property("Delimeter")); RequiredAttribute.Check(tag); }