本文整理汇总了C#中Template.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Template.Execute方法的具体用法?C# Template.Execute怎么用?C# Template.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template.Execute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModelPropertiesAreTraversed
public void ModelPropertiesAreTraversed()
{
var tt = new Template("#DateTime1.DayOfWeek");
var m = new Model1 { DateTime1 = SaturdayInSeptember };
var o = tt.Execute(m);
Assert.AreEqual("Saturday", o);
}
示例2: LiteralTextIsOutputLiterally
public void LiteralTextIsOutputLiterally()
{
const string txt = "abc";
var tt = new Template(txt);
var o = tt.Execute(new object());
Assert.AreEqual(txt, o);
}
示例3: IterationCollectsElements
public void IterationCollectsElements()
{
var tt = new Template("#|Days#DayOfWeek#.");
var m = new Model1 {Days = new[] {SaturdayInSeptember, SaturdayInSeptember.AddDays(1)}};
var o = tt.Execute(m);
Assert.AreEqual("SaturdaySunday", o);
}
示例4: WithinIterationParentModelPropertiesAreAccessible
public void WithinIterationParentModelPropertiesAreAccessible()
{
var tt = new Template("#|Days#DateTime1.DayOfWeek#.");
var m = new Model1
{
DateTime1 = SaturdayInSeptember,
Days = new[] { SaturdayInSeptember, SaturdayInSeptember.AddDays(1) }
};
var o = tt.Execute(m);
Assert.AreEqual("SaturdaySaturday", o);
}
示例5: IdentifiersAreNotCaseSensitive
public void IdentifiersAreNotCaseSensitive()
{
var tt = new Template("#DAYOFWEEK");
var o = tt.Execute(SaturdayInSeptember);
Assert.AreEqual("Saturday", o);
}
示例6: BracesOptionallyDelimitDirectives
public void BracesOptionallyDelimitDirectives()
{
var tt = new Template("#{DayOfWeek}");
var o = tt.Execute(SaturdayInSeptember);
Assert.AreEqual("Saturday", o);
}
示例7: AHashBeforeAnIdentifierSubstitutesAModelProperty
public void AHashBeforeAnIdentifierSubstitutesAModelProperty()
{
var tt = new Template("#DayOfWeek");
var o = tt.Execute(SaturdayInSeptember);
Assert.AreEqual("Saturday", o);
}
示例8: ADoubleHashIsEscaped
public void ADoubleHashIsEscaped()
{
var tt = new Template("##");
var o = tt.Execute(new object());
Assert.AreEqual("#", o);
}
示例9: AnEmptyTemplateProducesNoOutput
public void AnEmptyTemplateProducesNoOutput()
{
var tt = new Template("");
var o = tt.Execute(new object());
Assert.AreEqual("", o);
}