|
|
|
@ -1,7 +1,20 @@
|
|
|
|
|
namespace LibraryTests |
|
|
|
|
|
|
|
|
|
(* Initial Setup -- Populating the Test Folders. |
|
|
|
|
=========================================================================== |
|
|
|
|
If you have just cloned this repository or have not run any of the tests |
|
|
|
|
before, please head over to script.fs (in Test Centre) and populate the |
|
|
|
|
LoadingTestArea and SavingTestArea folders. More information will be |
|
|
|
|
provided there about what the scripts do. It is worth pointing out here, |
|
|
|
|
though, the .gitignore file ignores any .png files in them. |
|
|
|
|
This is why you must populate them before running any tests. *) |
|
|
|
|
|
|
|
|
|
module TestingHelpers = |
|
|
|
|
|
|
|
|
|
(* When you are writing tests, please keep all helper functions in this |
|
|
|
|
module. If this module grows to a point where it hinders the actual |
|
|
|
|
testing modules, consider moving it then. *) |
|
|
|
|
|
|
|
|
|
open System |
|
|
|
|
open System.Drawing |
|
|
|
|
open System.Reflection |
|
|
|
@ -20,7 +33,8 @@
|
|
|
|
|
let item = allColours.[Random().Next(allColours.Length)] |
|
|
|
|
item.GetValue(null, null) |
|
|
|
|
|
|
|
|
|
let imagesInLoadingTestArea = Directory.GetFileSystemEntries (loadLocation, "*.png") |
|
|
|
|
let imagesInLoadingTestArea = |
|
|
|
|
Directory.GetFileSystemEntries (loadLocation, "*.png") |
|
|
|
|
|
|
|
|
|
let generateLoadPath () = |
|
|
|
|
let rand = Random () |
|
|
|
@ -31,8 +45,6 @@
|
|
|
|
|
let fileName = Path.GetFileName originalFilePath |
|
|
|
|
saveLocation + "/" + fileName |
|
|
|
|
|
|
|
|
|
let fileSaved path = File.Exists path |
|
|
|
|
|
|
|
|
|
module PropertyTests = |
|
|
|
|
|
|
|
|
|
open FsCheck.Xunit |
|
|
|
@ -50,7 +62,7 @@
|
|
|
|
|
{ originalPath = oPath |
|
|
|
|
savePath = sPath |
|
|
|
|
colour = randomBrush () :?> Brush |
|
|
|
|
penWidth = float32 0.1 |
|
|
|
|
penWidth = float32 1 |
|
|
|
|
rows = 10 |
|
|
|
|
columns = 10 } |
|
|
|
|
applyGrid spec |
|
|
|
@ -59,11 +71,14 @@
|
|
|
|
|
|
|
|
|
|
module UnitTests = |
|
|
|
|
|
|
|
|
|
open System.IO |
|
|
|
|
open TestingHelpers |
|
|
|
|
open Xunit |
|
|
|
|
|
|
|
|
|
// This test is just a check to make sure the property tests have what they need to run. |
|
|
|
|
(* This test is a precaution (a test for the tests if you will...). |
|
|
|
|
It is here to make sure the property test has what it needs to run. |
|
|
|
|
If the property test fails, here is a good place to start. |
|
|
|
|
See script.fs (in Test Centre) for information on populating the |
|
|
|
|
LoadingTestArea folder. *) |
|
|
|
|
[<Fact>] |
|
|
|
|
let ``LoadingTestArea contains at least 100 test images`` () = |
|
|
|
|
let length = imagesInLoadingTestArea.Length |
|
|
|
|