From e898b404175aba32cc82565e5f2e97ad9c68b96b Mon Sep 17 00:00:00 2001 From: "OPTIMUS-PRIME\\craig" Date: Fri, 7 Sep 2018 19:12:29 +0100 Subject: [PATCH] add property test (CLI) -- build spec with border. --- TestCentre/ConsoleTests.fs | 39 ++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/TestCentre/ConsoleTests.fs b/TestCentre/ConsoleTests.fs index 95b44a6..d0ee47a 100644 --- a/TestCentre/ConsoleTests.fs +++ b/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)] [] let ``buildDefaultSpec creates intended type`` () = @@ -48,19 +50,24 @@ defaultSpec = spec [] - 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 [] @@ -83,6 +90,22 @@ buildSpec width height (fst mainColour) (fst overlayColour) overlay getDesktopPath expectedSpec = spec + [] + 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