Validating Phone Numbers in C# in Various Formats
Test CasesTesting the program with non-numeric characters:
Testing the program with alpha characters:
Testing the program with negative numbers:
ObservationsI observed that the C# code that I wrote can validate US phone numbers in different formats. There are no inputs that cause a runtime error because all the data are treated as a string (numbers are treated as string) and no data type conversion necessary that can cause a runtime error. There is no logic error as well but the program is only limited to validating the following phone number formats:
- The program makes sure that if dialing internationally then the first digit should be 1.