Browse Source

End of session commit.

The exception testing is very broken right now. Will neeed to sit down and go through it another time.
master
Craig Oates 6 years ago
parent
commit
7e00466057
  1. 30
      TestCentre/PropertyTests.fs
  2. 9
      TestCentre/UnitTests.fs

30
TestCentre/PropertyTests.fs

@ -41,7 +41,7 @@
let test () =
Pancake.RequestTextAsync 5 (ValidSentencesInput())
|> Async.RunSynchronously
let results () = Assert.NotNull test
let results = Assert.NotNull test
Check.Quick results
[<Property>]
@ -201,6 +201,12 @@
module ``Exception Tests`` =
(*
let expectDivideByZero() = Prop.throws<DivideByZeroException,_> (lazy (raise <| DivideByZeroException()))
Check.Quick expectDivideByZero
*)
(*
[<Property>]
let ``RequestText throws an ArgumentException when the gibberishLevel is invalid`` () =
let test =
@ -209,6 +215,15 @@
let results =
lazy Assert.Throws<ArgumentException>(fun () -> test |> ignore)
Check.Quick results
*)
//THIS IS A ROUGH TEST -- TO DELETE
[<Property>]
let ``RequestText throws an ArgumentException when the gibberishLevel is invalid`` () =
let test =
Pancake.RequestTextAsync 5 5
|> Async.RunSynchronously
Check.Quick (test)
[<Property>]
let ``RequestText throws an ArgumentException when the sentences count is invalid`` () =
@ -220,12 +235,21 @@
Check.Quick results
[<Property>]
let ``RequestTextFromFile throws an ArgumentException when the gibberishLeel in invalid`` () =
let test =
let ``RequestTextFromFile throws an ArgumentException when the gibberishLevel in invalid`` () =
let test () =
Pancake.RequestTextFromFileAsync (InvalidGibberishInput()) (ValidSentencesInput()) (ValidFileInput())
|> Async.RunSynchronously
let results =
lazy Assert.Throws<ArgumentException>(fun () -> test |> ignore)
Check.QuickThrowOnFailure results
[<Property>]
let ``RequestTextFromFile throws an ArgumentException when the sentences count is invalid`` () =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (InvalidSentencesInput()) (ValidFileInput())
|> Async.RunSynchronously
let results =
lazy Assert.Throws<ArgumentException>(fun () -> test |> ignore)
Check.Quick results
(*
let SentencesIsValid sentences =

9
TestCentre/UnitTests.fs

@ -174,7 +174,7 @@ let FilePathIsValid filePath
let test () =
Pancake.RequestTextAsync (InvalidGibberishInput()) (ValidSentencesInput())
|> Async.RunSynchronously
lazy Assert.Throws<ArgumentException>(fun () -> test |> ignore)
lazy Assert.Throws<ArgumentException>(fun () -> test() |> ignore)
[<Fact>]
let ``RequestText throws an ArgumentException when the sentences count is invalid`` () =
@ -189,3 +189,10 @@ let FilePathIsValid filePath
Pancake.RequestTextFromFileAsync (InvalidGibberishInput()) (ValidSentencesInput()) (ValidFileInput())
|> Async.RunSynchronously
lazy Assert.Throws<ArgumentException>(fun () -> test |> ignore)
[<Fact>]
let ``RequestTextFromFile throws an ArgumentException when the sentences count is invalid`` () =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (InvalidSentencesInput()) (ValidFileInput())
|> Async.RunSynchronously
lazy Assert.Throws<ArgumentException>(fun () -> test |> ignore)

Loading…
Cancel
Save