Sha256: 593a2b3c59ca6b462072fc548a6c3faad8eae7738562592f556134f237d6d167

Contents?: true

Size: 1.56 KB

Versions: 240

Compression:

Stored size: 1.56 KB

Contents

module PhoneNumberTest

open NUnit.Framework

open PhoneNumber

[<Test>]
let ``Cleans phone number`` () =
    Assert.That(parsePhoneNumber "(123) 456-7890", Is.EqualTo(Some "1234567890"))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Cleans phone number with dots`` () =
    Assert.That(parsePhoneNumber "123.456.7890", Is.EqualTo(Some "1234567890"))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Valid when 11 digits and first is 1`` () =
    Assert.That(parsePhoneNumber "11234567890", Is.EqualTo(Some "1234567890"))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Invalid when 11 digits`` () =
    Assert.That(parsePhoneNumber "21234567890", Is.EqualTo(None))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Invalid when 9 digits`` () =
    Assert.That(parsePhoneNumber "123456789", Is.EqualTo(None))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Invalid when 12 digits`` () =
    Assert.That(parsePhoneNumber "123456789012", Is.EqualTo(None))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Invalid when empty`` () =
    Assert.That(parsePhoneNumber "", Is.EqualTo(None))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Invalid when no digits present`` () =
    Assert.That(parsePhoneNumber " (-) ", Is.EqualTo(None))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Valid with leading characters`` () =
    Assert.That(parsePhoneNumber "my parsePhoneNumber is 123 456 7890", Is.EqualTo(Some "1234567890"))

[<Test>]
[<Ignore("Remove to run test")>]
let ``Valid with trailing characters`` () =
    Assert.That(parsePhoneNumber "123 456 7890 - bob", Is.EqualTo(Some "1234567890"))

Version data entries

240 entries across 240 versions & 1 rubygems

Version Path
trackler-2.2.1.22 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.21 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.20 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.19 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.18 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.17 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.16 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.15 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.14 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.13 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.12 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.11 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.10 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.9 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.8 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.7 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.6 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.5 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.4 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.2.1.3 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs