Browse Source

Fixed bug in unit tests.

Began adding contents checks in unit tests. Because the code is now using async, the tests return the task properties and not the content anymore.
master
Craig Oates 6 years ago
parent
commit
a481cd02fb
  1. 19
      TestCentre/UnitTests.fs
  2. 2
      WetPancake/Script.fsx

19
TestCentre/UnitTests.fs

@ -4,7 +4,9 @@
open WetPancake
open TestingConstants
open System.IO
// File Access Checks =====================================================================================================
(* These tests check to see if the .txt files exists in the Test Centre project.
The WetPancake library does not expose the file access functions so the .txt files are mirrored here (in Test Centre).
The mirroring, also, doubles up as sample files to pass into WetPancake. *)
@ -28,10 +30,12 @@
let ``test-post can be found`` () =
let result = File.Exists TestPost
Assert.Equal(true, result)
// Null Checks ==========================================================================================================
[<Fact>]
let ``RequestRandomText does not return a null`` () =
let result = Pancake.RequestRandomText
let result = Pancake.RequestRandomText ()
Assert.NotNull result
[<Fact>]
@ -67,4 +71,11 @@
let gibberishLevel = System.Random().Next(2, 20)
let totalSentences = System.Random().Next(2, 20)
let result = Pancake.RequestTextFromFile gibberishLevel totalSentences TestPost
Assert.NotNull result
Assert.NotNull result
// Contents Checks ========================================================================================================
[<Fact>]
let ``RequestRandomText returns a string which contains at least one full stop`` () =
let result = Pancake.RequestRandomText () |> Async.RunSynchronously
Assert.Contains(".", result)

2
WetPancake/Script.fsx

@ -9,7 +9,6 @@
#load "DataServices.fs"
#load "ProductServices.fs"
open System
open SystemServices
open DataAccess
open DataCleaning
@ -17,7 +16,6 @@ open DataProcessing
open DataStructuring
open DataServices
open WetPancake
open System.Data
// System Services
let ss_number = PickRandomNumber 10

Loading…
Cancel
Save