diff --git a/TestCentre/ConsoleTests.fs b/TestCentre/ConsoleTests.fs index f3e0580..106e7fc 100644 --- a/TestCentre/ConsoleTests.fs +++ b/TestCentre/ConsoleTests.fs @@ -5,17 +5,21 @@ open System open DeathSocketCLI.Validation + // Directory Path let saveLocation = __SOURCE_DIRECTORY__ + "/SavingTestArea" - let loadLocation = __SOURCE_DIRECTORY__ + "/LoadingTestArea" + // File Path + let loadPath = loadLocation + "/LoadTest.png" + let savePath = saveLocation + "/SaveTest.png" + let testingColourArray = colourList |> Map.toSeq |> Seq.map fst |> Seq.toArray - let randomColour () = + let randomColourString () = testingColourArray.[Random().Next(testingColourArray.Length - 1)] let randomBrush () = @@ -40,15 +44,13 @@ [] let ``Parsed colour matches expected colour`` () = - let expectedColour = (randomColour ()) + let expectedColour = (randomColourString ()) let brush = parseColour (expectedColour) let convertedBrush = ((brush :?> SolidBrush).Color.Name.ToLower()) convertedBrush = expectedColour [] - let ``Can make an intended default image specification`` () = - let loadPath = loadLocation + "/LoadTest.png" - let savePath = saveLocation + "/SaveTest.png" + let ``Can build the intended default image specification`` () = let defaultSpec = { originalPath = loadPath savePath = savePath @@ -59,6 +61,23 @@ let spec = buildDefaultSpec loadPath savePath defaultSpec = spec + [] + let ``Can build an image specification as intended`` () = + let colourString = randomColourString () + let brush = parseColour colourString + let pWidth = float32 (Random().Next()) + let randRows = Random().Next() + let randCols = Random().Next() + let intendedSpec = + { originalPath = loadPath + savePath = savePath + colour = brush + penWidth = pWidth + rows =randRows + columns = randCols } + let spec = buildSpec loadPath randRows randCols pWidth colourString savePath + intendedSpec = spec + module UnitTests = open System.IO