本文整理汇总了C#中Parser.PopulateStringVariables方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.PopulateStringVariables方法的具体用法?C# Parser.PopulateStringVariables怎么用?C# Parser.PopulateStringVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parser
的用法示例。
在下文中一共展示了Parser.PopulateStringVariables方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateDuplicateStringVariablesShouldYieldExpectedOutcome4
public void PopulateDuplicateStringVariablesShouldYieldExpectedOutcome4()
{
const string input = "I {{modifier}} {{verb}} to the {{place}}. Yes, I {{verb}}.";
var variables = new List<StringVariable>
{
new StringVariable
{
Name = "modifier",
Value = "usually"
},
new StringVariable
{
Name = "verb",
Value = "hike"
},
new StringVariable
{
Name = "place",
Value = "park"
}
};
var service = new Parser();
var result = service.PopulateStringVariables(variables, input);
Assert.AreEqual("I usually hike to the park. Yes, I hike.", result);
}
示例2: PopulateHtmlVariablesShouldYieldExpectedOutcome1
public void PopulateHtmlVariablesShouldYieldExpectedOutcome1()
{
const string input = "<html>I {{verb}} to the <b>store</b>.</html>";
var variables = new List<StringVariable>
{
new StringVariable
{
Name = "verb",
Value = "walked"
}
};
var service = new Parser();
var result = service.PopulateStringVariables(variables, input);
Assert.AreEqual("<html>I walked to the <b>store</b>.</html>", result);
}
示例3: PopulateStringVariablesShouldYieldExpectedOutcome2
public void PopulateStringVariablesShouldYieldExpectedOutcome2()
{
const string input = "I {{modifier}} {{verb}} to the store.";
var variables = new List<StringVariable>
{
new StringVariable
{
Name = "modifier",
Value = "often"
},
new StringVariable
{
Name = "verb",
Value = "jog"
}
};
var service = new Parser();
var result = service.PopulateStringVariables(variables, input);
Assert.AreEqual("I often jog to the store.", result);
}
示例4: PopulateStringVariablesShouldYieldExpectedOutcome1
public void PopulateStringVariablesShouldYieldExpectedOutcome1()
{
const string input = "I {{verb}} to the store.";
var variables = new List<StringVariable>
{
new StringVariable
{
Name = "verb",
Value = "ran"
}
};
var service = new Parser();
var result = service.PopulateStringVariables(variables, input);
Assert.AreEqual("I ran to the store.", result);
}