예제 #1
0
		public void TestInvalidElementStringParse()
		{
			try
			{
				// on the other hand, invalid combo strings should throw exceptions during conversion
				XMouseButtonCombo.Parse("NonExistentCombo");
				Assert.Fail("Expected an exception because the parsed string has an invalid element name");
			}
			catch (FormatException) {}
		}
예제 #2
0
		public void TestInvalidModifiersOnlyStringParse()
		{
			try
			{
				// on the other hand, invalid combo strings should throw exceptions during conversion
				XMouseButtonCombo.Parse("Ctrl+Shift");
				Assert.Fail("Expected an exception because the parsed string has no mouse button, only modifiers");
			}
			catch (FormatException) {}
		}
예제 #3
0
		public void TestInvalidStringParse()
		{
			try
			{
				// on the other hand, invalid combo strings should throw exceptions during conversion
				XMouseButtonCombo.Parse("\n");
				Assert.Fail("Expected an exception because the parsed string has an invalid character");
			}
			catch (FormatException) {}
		}
예제 #4
0
		public void TestInvalidElementLeadingSeparatorStringParse()
		{
			try
			{
				// on the other hand, invalid combo strings should throw exceptions during conversion
				XMouseButtonCombo.Parse("+Right Mouse Button");
				Assert.Fail("Expected an exception because of a leading separator in the parse string");
			}
			catch (FormatException) {}
		}
예제 #5
0
		public void TestEmptyStringParse()
		{
			// empty strings should parse to XMouseButtonCombo.None
			XMouseButtonCombo mouseButtonCombo = XMouseButtonCombo.Parse(string.Empty);
			Assert.AreEqual(XMouseButtonCombo.None, mouseButtonCombo, "empty strings should parse to XMouseButtonCombo.None");
		}
예제 #6
0
		private static void AssertStringParse(string sMouseButtonCombo, XMouseButtonCombo vMouseButtonCombo, CultureInfo culture, string message)
		{
			XMouseButtonCombo actualValue = XMouseButtonCombo.Parse(sMouseButtonCombo, culture);
			//System.Diagnostics.Trace.WriteLine(actualValue);
			Assert.AreEqual(vMouseButtonCombo, actualValue, "{0}: converting {1} which is {2}", message, sMouseButtonCombo, actualValue);
		}