当前位置: 首页>>代码示例>>C#>>正文


C# Parser.PopulateStringVariables方法代码示例

本文整理汇总了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);
		}
开发者ID:Xaniff,项目名称:DotNetEmailTemplater,代码行数:27,代码来源:Tests.cs

示例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);
		}
开发者ID:Xaniff,项目名称:DotNetEmailTemplater,代码行数:17,代码来源:Tests.cs

示例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);
		}
开发者ID:Xaniff,项目名称:DotNetEmailTemplater,代码行数:22,代码来源:Tests.cs

示例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);
		}
开发者ID:Xaniff,项目名称:DotNetEmailTemplater,代码行数:17,代码来源:Tests.cs


注:本文中的Parser.PopulateStringVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。