當前位置: 首頁>>代碼示例>>C#>>正文


C# Switch.GetArgumentValues方法代碼示例

本文整理匯總了C#中System.Switch.GetArgumentValues方法的典型用法代碼示例。如果您正苦於以下問題:C# Switch.GetArgumentValues方法的具體用法?C# Switch.GetArgumentValues怎麽用?C# Switch.GetArgumentValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Switch的用法示例。


在下文中一共展示了Switch.GetArgumentValues方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例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: 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.GetArgumentValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。