forked from exercism/csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhoneNumberTest.cs
More file actions
90 lines (77 loc) · 2.42 KB
/
Copy pathPhoneNumberTest.cs
File metadata and controls
90 lines (77 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// This file was auto-generated based on version 1.2.0 of the canonical data.
using Xunit;
public class PhoneNumberTest
{
[Fact]
public void Cleans_the_number()
{
var phrase = "(223) 456-7890";
Assert.Equal("2234567890", PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Cleans_numbers_with_dots()
{
var phrase = "223.456.7890";
Assert.Equal("2234567890", PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Cleans_numbers_with_multiple_spaces()
{
var phrase = "223 456 7890 ";
Assert.Equal("2234567890", PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_when_9_digits()
{
var phrase = "123456789";
Assert.Null(PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_when_11_digits_does_not_start_with_a_1()
{
var phrase = "22234567890";
Assert.Null(PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Valid_when_11_digits_and_starting_with_1()
{
var phrase = "12234567890";
Assert.Equal("2234567890", PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Valid_when_11_digits_and_starting_with_1_even_with_punctuation()
{
var phrase = "+1 (223) 456-7890";
Assert.Equal("2234567890", PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_when_more_than_11_digits()
{
var phrase = "321234567890";
Assert.Null(PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_with_letters()
{
var phrase = "123-abc-7890";
Assert.Null(PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_with_punctuations()
{
var phrase = "123-@:!-7890";
Assert.Null(PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_if_area_code_does_not_start_with_2_9()
{
var phrase = "(123) 456-7890";
Assert.Null(PhoneNumber.Clean(phrase));
}
[Fact(Skip = "Remove to run test")]
public void Invalid_if_exchange_code_does_not_start_with_2_9()
{
var phrase = "(223) 056-7890";
Assert.Null(PhoneNumber.Clean(phrase));
}
}