public void FormatNumberString() { Assert.AreEqual(NumberStringUtils.FormatNumberString(internalNumber), internalNumber); Assert.AreEqual(NumberStringUtils.FormatNumberString(externalNumber), externalNumber); Assert.AreEqual(NumberStringUtils.FormatNumberString(noPossibleNumber), noPossibleNumber2); Assert.AreEqual(NumberStringUtils.FormatNumberString(noValidNumber), noValidNumber); Assert.AreEqual(NumberStringUtils.FormatNumberString(externalWithSymbols), externalNumber); Assert.AreEqual(NumberStringUtils.FormatNumberString(externalGerman), externalNumber); Assert.AreEqual(NumberStringUtils.FormatNumberString(externalAustria), externalAustria2); Assert.AreEqual(NumberStringUtils.FormatNumberString(externalAustria2), externalAustria2); }
/// <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; } }