public void TestIsValidPhoneNumber() { Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(internalNumber), NumberStringType.INTERNAL); Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(externalNumber), NumberStringType.EXTERNAL); Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(noPossibleNumber), NumberStringType.NOT_POSSIBLE); Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(noValidNumber), NumberStringType.NOT_VALID); Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(externalWithSymbols), NumberStringType.EXTERNAL); Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(externalGerman), NumberStringType.EXTERNAL); Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(externalAustria), NumberStringType.EXTERNAL); Assert.AreEqual(NumberStringUtils.IsValidPhoneNumber(externalAustria2), NumberStringType.EXTERNAL); }
/// <summary> /// Checks if the content of the clipboard can be used as a number and sets the current number if so. /// </summary> private void ProcessClipboardContent() { NumberStringType type = NumberStringUtils.IsValidPhoneNumber(_currentClipboardContent); switch (type) { case NumberStringType.NOT_POSSIBLE: // Do nothing because the clipboard does not contain a number break; case NumberStringType.NOT_VALID: // Do nothing because the content of the clipboard is not a valid number // Here the option could be implementet, to inform the user about the fact he has copied a possible but not valid number. // It could be a valid number in another country. This could be checked. break; default: CurrentNumber = new Number(NumberStringUtils.FormatNumberString(_currentClipboardContent), type); Clipboard.Clear(); // Bugfix to stop randomly appearing balllon tipps if you copy a valid external/internal number break; } }