|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
open WetPancake |
|
|
|
|
open TestingConstants |
|
|
|
|
open System.Diagnostics |
|
|
|
|
open System |
|
|
|
|
|
|
|
|
|
module ``Null Tests`` = |
|
|
|
|
|
|
|
|
@ -220,20 +221,32 @@
|
|
|
|
|
Check.Quick results |
|
|
|
|
|
|
|
|
|
module ``Exception Tests`` = |
|
|
|
|
open System |
|
|
|
|
open System.Threading.Tasks |
|
|
|
|
|
|
|
|
|
// YOU ARE HERE -- WRITE EXCEPTION TESTS (DON'T FOGET UNIT TESTS). |
|
|
|
|
// Move this to an input generator module? seperate file? |
|
|
|
|
// Will remove the copy and pasted code up above as well... |
|
|
|
|
// Keep this and property test files about just the tests... |
|
|
|
|
|
|
|
|
|
let ValidGibberishLevelInput () = |
|
|
|
|
let testInputs = [|2 .. 20|] |
|
|
|
|
let index = Random().Next(0, testInputs.Length) |
|
|
|
|
testInputs.[index] |
|
|
|
|
|
|
|
|
|
let ValidSentencesInput () = System.Random().Next(2, 10) |
|
|
|
|
|
|
|
|
|
let InvalidGibberishInput () = |
|
|
|
|
let testInputs = Array.concat [ [|0; 1|] ; [|21 .. 100|] ] |
|
|
|
|
let index = System.Random().Next(0, testInputs.Length) |
|
|
|
|
testInputs.[index] |
|
|
|
|
|
|
|
|
|
let InvalidSentencesInput () = System.Random().Next(-5, 1) |
|
|
|
|
|
|
|
|
|
[<Property>] |
|
|
|
|
let ``RequestText throws an ArgumentException when the gibberishLevel is invalid`` () = |
|
|
|
|
//let gibberishLevel () = System.Random().Next(0, 1) |
|
|
|
|
let totalSentences () = System.Random().Next(2, 10) |
|
|
|
|
let test = |
|
|
|
|
Pancake.RequestTextAsync 0 (totalSentences()) |
|
|
|
|
let test () = |
|
|
|
|
Pancake.RequestTextAsync (InvalidGibberishInput()) (ValidSentencesInput()) |
|
|
|
|
|> Async.RunSynchronously |
|
|
|
|
let results = |
|
|
|
|
lazy Assert.Throws<ArgumentException>(fun () -> test |> ignore) |
|
|
|
|
|> ignore |
|
|
|
|
Check.Quick results |
|
|
|
|
|
|
|
|
|
(* |
|
|
|
|