Browse Source

add property test (CLI) -- build spec with border.

master
Craig Oates 6 years ago
parent
commit
e898b40417
  1. 39
      TestCentre/ConsoleTests.fs

39
TestCentre/ConsoleTests.fs

@ -24,11 +24,13 @@
|> Map.toList
|> List.item (Random().Next(colourList.Count))
let overlays = [|"none"; "n"; "full"; "f"|]
let overlays = [|"none"; "n"; "b"; "border"; "full"; "f"|]
let noOverlay () = overlays.[Random().Next(0, 1)]
let fullOverlay () = overlays.[Random().Next(2, 3)]
let borderOverlay () = overlays.[Random().Next(2, 3)]
let fullOverlay () = overlays.[Random().Next(4, 5)]
[<Property>]
let ``buildDefaultSpec creates intended type`` () =
@ -48,19 +50,24 @@
defaultSpec = spec
[<Property>]
let ``buildSpec creates intended type with no overlay`` () =
let ``buildSpec creates intended type with border`` () =
let width = randomInt ()
let height = randomInt ()
let colour = randomColour ()
let overlay = noOverlay ()
let mainColour = randomColour ()
let overlayColour = randomColour ()
let overlay = borderOverlay ()
let oSpec =
{ colour = (snd) overlayColour
overlayType = Border }
let expectedSpec =
{ width = width
height = height
colour = snd colour
colour = (snd) mainColour
filePath = getDesktopPath
overlay = option.None }
overlay = Some oSpec
}
let spec =
buildSpec width height (fst colour) (fst colour) overlay getDesktopPath
buildSpec width height (fst mainColour) (fst overlayColour) overlay getDesktopPath
expectedSpec = spec
[<Property>]
@ -83,6 +90,22 @@
buildSpec width height (fst mainColour) (fst overlayColour) overlay getDesktopPath
expectedSpec = spec
[<Property>]
let ``buildSpec creates intended type with no overlay`` () =
let width = randomInt ()
let height = randomInt ()
let colour = randomColour ()
let overlay = noOverlay ()
let expectedSpec =
{ width = width
height = height
colour = snd colour
filePath = getDesktopPath
overlay = option.None }
let spec =
buildSpec width height (fst colour) (fst colour) overlay getDesktopPath
expectedSpec = spec
module UnitTests =
open Xunit

Loading…
Cancel
Save