コード例 #1
0
ファイル: ForTokensTest.cs プロジェクト: rslijp/sharptiles
 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]"));
 }
コード例 #2
0
ファイル: ForTokensTest.cs プロジェクト: rslijp/sharptiles
 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));
 }
コード例 #3
0
ファイル: ForTokensTest.cs プロジェクト: rslijp/sharptiles
 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]"));
 }
コード例 #4
0
ファイル: ForTokensTest.cs プロジェクト: rslijp/sharptiles
 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]"));
 }
コード例 #5
0
ファイル: ForTokensTest.cs プロジェクト: rslijp/sharptiles
 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]"));
 }
コード例 #6
0
ファイル: ForTokensTest.cs プロジェクト: rslijp/sharptiles
 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));
 }
コード例 #7
0
ファイル: ForTokensTest.cs プロジェクト: rslijp/sharptiles
 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);
 }