1
exercism fetch fsharp robot-name

RobotNameTest.fs

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
module RobotNameTest

open Xunit
open FsUnit.Xunit
open System.Text.RegularExpressions
open RobotName

[<Fact>]
let ``Robot has a name`` () =     
    let robot = mkRobot()
    Regex.IsMatch(name robot, @"\w{2}\d{3}") |> should equal true
    
[<Fact(Skip = "Remove to run test")>]
let ``Name is the same each time`` () =     
    let robot = mkRobot()
    name robot |> should equal (name robot)
    
[<Fact(Skip = "Remove to run test")>]
let ``Different robots have different names`` () = 
    let robot = mkRobot()
    let robot2 = mkRobot()
    name robot |> should not' (equal (name robot2))
    
[<Fact(Skip = "Remove to run test")>]
let ``Can reset the name`` () =  
    let robot = mkRobot()
    let originalName = name robot
    let resetRobot = reset robot
    originalName |> should not' (equal (name resetRobot))