module MinesweeperTest open Xunit open FsUnit.Xunit open Minesweeper let concat = List.reduce (fun x y -> x + "\n" + y) [] let ``Zero size board`` () = let actual = "" let expected = "" annotate actual |> should equal expected [] let ``Empty board`` () = let actual = [" "; " "; " "] |> concat let expected = [" "; " "; " "] |> concat annotate actual |> should equal expected [] let ``Board full of mines`` () = let actual = ["***"; "***"; "***"] |> concat let expected = ["***"; "***"; "***"] |> concat annotate actual |> should equal expected [] let ``Surrounded`` () = let actual = ["***"; "* *"; "***"] |> concat let expected = ["***"; "*8*"; "***"] |> concat annotate actual |> should equal expected [] let ``Horizontal line`` () = let actual = [" * * "] |> concat let expected = ["1*2*1"] |> concat annotate actual |> should equal expected [] let ``Vertical line`` () = let actual = [" "; "*"; " "; "*"; " "] |> concat let expected = ["1"; "*"; "2"; "*"; "1"] |> concat annotate actual |> should equal expected [] let ``Cross`` () = let actual = [" * "; " * "; "*****"; " * "; " * "] |> concat let expected = [" 2*2 "; "25*52"; "*****"; "25*52"; " 2*2 "] |> concat annotate actual |> should equal expected