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.1.0.24 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.23 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.22 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.21 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.20 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.19 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.18 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.17 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.16 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.15 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.14 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.13 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.12 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.11 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.10 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.9 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.8 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.7 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.6 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs
trackler-2.1.0.5 tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs