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


C# Switch.GetArgumentNames方法代码示例

本文整理汇总了C#中System.Switch.GetArgumentNames方法的典型用法代码示例。如果您正苦于以下问题:C# Switch.GetArgumentNames方法的具体用法?C# Switch.GetArgumentNames怎么用?C# Switch.GetArgumentNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Switch的用法示例。


在下文中一共展示了Switch.GetArgumentNames方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppendSwitch

		/// <summary>
		/// Append given switch to given output.
		/// </summary>
		/// <param name="switchObject">
		/// Switch object representing switch to append to given output.
		/// </param>
		/// <param name="output">
		/// StringBuilder object representing output to append to.
		/// </param>
		static void AppendSwitch(Switch switchObject, StringBuilder output)
		{
			if (switchObject.IsOptional)
				output.Append(OptionalSwitchTag.Start);

			output.Append(Switch.GetPrefixedName(switchObject.Name));

			if (switchObject.HasArguments)
			{
				output.Append(Character.Space);

				AppendArgumentNames(switchObject.GetArgumentNames(), output);
			}

			if (switchObject.IsOptional)
				output.Append(OptionalSwitchTag.End);
		}
开发者ID:bbadjari,项目名称:ccli,代码行数:26,代码来源:HelpPrinter.cs

示例2: AddArgumentValue

		public void AddArgumentValue()
		{
			const string ArgumentValue1 = "value1";
			const string ArgumentValue2 = "value2";

			string[] argumentNames = new string[] { "arg1", "arg2" };
			string[] argumentValues1 = new string[] { ArgumentValue1 };
			string[] argumentValues2 = new string[] { ArgumentValue1, ArgumentValue2 };

			Switch switchObject = new Switch(Name, LongName, Description,
				IsRequired, argumentNames);

			// Add first argument value.

			switchObject.AddArgumentValue(ArgumentValue1);

			Assert.AreEqual(argumentNames, switchObject.GetArgumentNames());
			Assert.AreEqual(argumentValues1, switchObject.GetArgumentValues());
			Assert.AreEqual(argumentNames.Length, switchObject.NumberArguments);

			Assert.IsFalse(switchObject.HasEnoughValues);

			Assert.IsTrue(switchObject.HasArguments);
			Assert.IsTrue(switchObject.HasEnoughNames);

			// Add second argument value.

			switchObject.AddArgumentValue(ArgumentValue2);

			Assert.AreEqual(argumentNames, switchObject.GetArgumentNames());
			Assert.AreEqual(argumentValues2, switchObject.GetArgumentValues());
			Assert.AreEqual(argumentNames.Length, switchObject.NumberArguments);

			Assert.IsTrue(switchObject.HasArguments);
			Assert.IsTrue(switchObject.HasEnoughNames);
			Assert.IsTrue(switchObject.HasEnoughValues);
		}
开发者ID:bbadjari,项目名称:ccli,代码行数:37,代码来源:SwitchTest.cs

示例3: WithSameNames

		public void WithSameNames()
		{
			Switch switchObject = new Switch(Name, Name, Description);

			Assert.AreEqual(Description, switchObject.Description);
			Assert.AreEqual(NoArgumentNames, switchObject.GetArgumentNames());
			Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
			Assert.AreEqual(Name, switchObject.Name);
			Assert.AreEqual(NoArguments, switchObject.NumberArguments);

			Assert.AreNotEqual(Name, switchObject.LongName);

			Assert.IsFalse(switchObject.HasArguments);
			Assert.IsFalse(switchObject.HasEnoughNames);
			Assert.IsFalse(switchObject.HasEnoughValues);
			Assert.IsFalse(switchObject.HasLongName);
			Assert.IsFalse(switchObject.IsRequired);

			Assert.IsNotNull(switchObject.Description);
			Assert.IsNotNull(switchObject.Name);

			Assert.IsNull(switchObject.LongName);

			Assert.IsTrue(switchObject.HasDescription);
			Assert.IsTrue(switchObject.IsOptional);
		}
开发者ID:bbadjari,项目名称:ccli,代码行数:26,代码来源:SwitchTest.cs

示例4: WithNumberArgumentsNonPrintable

		public void WithNumberArgumentsNonPrintable()
		{
			const int NumberArguments = 5;

			Switch switchObject = new Switch(Name, NumberArguments);

			Assert.AreEqual(NoArgumentNames, switchObject.GetArgumentNames());
			Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
			Assert.AreEqual(Name, switchObject.Name);
			Assert.AreEqual(NumberArguments, switchObject.NumberArguments);

			Assert.IsFalse(switchObject.HasDescription);
			Assert.IsFalse(switchObject.HasEnoughNames);
			Assert.IsFalse(switchObject.HasEnoughValues);
			Assert.IsFalse(switchObject.HasLongName);
			Assert.IsFalse(switchObject.IsRequired);

			Assert.IsNotNull(switchObject.Name);

			Assert.IsNull(switchObject.Description);
			Assert.IsNull(switchObject.LongName);

			Assert.IsTrue(switchObject.HasArguments);
			Assert.IsTrue(switchObject.IsOptional);
		}
开发者ID:bbadjari,项目名称:ccli,代码行数:25,代码来源:SwitchTest.cs

示例5: WithArgumentsName

		public void WithArgumentsName()
		{
			const string ArgumentName = "args";

			Switch switchObject = new Switch(Name, LongName, Description,
				HasArguments, IsRequired, ArgumentName);

			Assert.AreEqual(Description, switchObject.Description);
			Assert.AreEqual(new string[] { ArgumentName }, switchObject.GetArgumentNames());
			Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
			Assert.AreEqual(LongName, switchObject.LongName);
			Assert.AreEqual(Name, switchObject.Name);
			Assert.AreEqual(UnknownNumberArguments, switchObject.NumberArguments);

			Assert.IsFalse(switchObject.HasEnoughValues);
			Assert.IsFalse(switchObject.IsOptional);

			Assert.IsNotNull(switchObject.Description);
			Assert.IsNotNull(switchObject.LongName);
			Assert.IsNotNull(switchObject.Name);

			Assert.IsTrue(switchObject.HasArguments);
			Assert.IsTrue(switchObject.HasDescription);
			Assert.IsTrue(switchObject.HasEnoughNames);
			Assert.IsTrue(switchObject.HasLongName);
			Assert.IsTrue(switchObject.IsRequired);
		}
开发者ID:bbadjari,项目名称:ccli,代码行数:27,代码来源:SwitchTest.cs

示例6: WithArgumentNames

		public void WithArgumentNames()
		{
			string[] argumentNames = new string[] { "arg1", "arg2", "arg3" };

			Switch switchObject = new Switch(Name, LongName, Description,
				IsRequired, argumentNames);

			Assert.AreEqual(Description, switchObject.Description);
			Assert.AreEqual(argumentNames, switchObject.GetArgumentNames());
			Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
			Assert.AreEqual(LongName, switchObject.LongName);
			Assert.AreEqual(Name, switchObject.Name);
			Assert.AreEqual(argumentNames.Length, switchObject.NumberArguments);

			Assert.IsFalse(switchObject.HasEnoughValues);
			Assert.IsFalse(switchObject.IsOptional);

			Assert.IsNotNull(switchObject.Description);
			Assert.IsNotNull(switchObject.LongName);
			Assert.IsNotNull(switchObject.Name);

			Assert.IsTrue(switchObject.HasArguments);
			Assert.IsTrue(switchObject.HasDescription);
			Assert.IsTrue(switchObject.HasEnoughNames);
			Assert.IsTrue(switchObject.HasLongName);
			Assert.IsTrue(switchObject.IsRequired);
		}
开发者ID:bbadjari,项目名称:ccli,代码行数:27,代码来源:SwitchTest.cs


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