本文整理汇总了C#中Template.PrepareDynamicRendering方法的典型用法代码示例。如果您正苦于以下问题:C# Template.PrepareDynamicRendering方法的具体用法?C# Template.PrepareDynamicRendering怎么用?C# Template.PrepareDynamicRendering使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template.PrepareDynamicRendering方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rendering_replaces_template_key_with_model_value
public void Rendering_replaces_template_key_with_model_value()
{
var template = new Template(_name, "${SomeKey} SomeKey", _factory);
_templateModel.Stub(m => m.GetProperty("SomeKey")).Return("some value");
template.PrepareDynamicRendering();
var renderedText = template.Render(_viewModel);
Assert.AreEqual("some value SomeKey", renderedText);
}
示例2: Rendering_replaces_several_occurances_of_the_same_template_key_with_the_same_model_value
public void Rendering_replaces_several_occurances_of_the_same_template_key_with_the_same_model_value()
{
var template = new Template(_name, "${Repeat}, ${Repeat}, ${Repeat}, ${Repeat} Claudius!", _factory);
_templateModel.Stub(m => m.GetProperty("Repeat")).Return("I");
template.PrepareDynamicRendering();
var renderedText = template.Render(_viewModel);
Assert.AreEqual("I, I, I, I Claudius!", renderedText);
}
示例3: Rendering_capitalises_template_key
public void Rendering_capitalises_template_key()
{
var template = new Template(_name, "${minusculeName}", _factory);
_templateModel.Stub(m => m.GetProperty("MinusculeName")).Return("I got capitalised!");
template.PrepareDynamicRendering();
var renderedText = template.Render(_viewModel);
Assert.AreEqual("I got capitalised!", renderedText);
}
示例4: Rendering_replaces_several_template_keys_with_model_values
public void Rendering_replaces_several_template_keys_with_model_values()
{
var template = new Template(_name, "count: ${FirstKey}, ${SecondKey}, ${ThirdKey}", _factory);
_templateModel.Stub(m => m.GetProperty("FirstKey")).Return("One");
_templateModel.Stub(m => m.GetProperty("SecondKey")).Return("Two");
_templateModel.Stub(m => m.GetProperty("ThirdKey")).Return("Three");
template.PrepareDynamicRendering();
var renderedText = template.Render(_viewModel);
Assert.AreEqual("count: One, Two, Three", renderedText);
}
示例5: Rendering_untemplated_text_replaces_nothing
public void Rendering_untemplated_text_replaces_nothing()
{
var text = "${TemplateKey";
var text2 = "{TemplateKey}";
var text3 = "$TemplateKey}";
var text4 = "TemplateKey";
var template = new Template(_name, text, _factory);
var template2 = new Template(_name, text2, _factory);
var template3 = new Template(_name, text3, _factory);
var template4 = new Template(_name, text4, _factory);
_templateModel.Stub(m => m.GetProperty("TemplateKey")).Return("Different value")
.Repeat.Times(4);
template.PrepareDynamicRendering();
template2.PrepareDynamicRendering();
template3.PrepareDynamicRendering();
template4.PrepareDynamicRendering();
var renderedText = template.Render(_viewModel);
var renderedText2 = template2.Render(_viewModel);
var renderedText3 = template3.Render(_viewModel);
var renderedText4 = template4.Render(_viewModel);
Assert.AreEqual(text, renderedText);
Assert.AreEqual(text2, renderedText2);
Assert.AreEqual(text3, renderedText3);
Assert.AreEqual(text4, renderedText4);
}