8 changed files with 450 additions and 180 deletions
@ -1,70 +1,180 @@
|
||||
module ``Unit Tests`` |
||||
module ``Unit Tests`` |
||||
|
||||
open Xunit |
||||
open WetPancake |
||||
open TestingConstants |
||||
open System.IO |
||||
|
||||
(* 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. *) |
||||
|
||||
[<Fact>] |
||||
let ``desktop-clock-info can be found`` () = |
||||
let result = File.Exists DesktopClock |
||||
Assert.Equal(true, result); |
||||
|
||||
[<Fact>] |
||||
let ``console-waterworks-announcements can be found`` () = |
||||
let result = File.Exists ConsoleWaterworks |
||||
Assert.Equal(true, result); |
||||
|
||||
[<Fact>] |
||||
let ``word-generator can be found`` () = |
||||
let result = File.Exists WordGenerator |
||||
Assert.Equal(true, result); |
||||
|
||||
[<Fact>] |
||||
let ``test-post can be found`` () = |
||||
let result = File.Exists TestPost |
||||
Assert.Equal(true, result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestRandomText does not return a null`` () = |
||||
let result = Pancake.RequestRandomText |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestText does not return a null`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result () = Pancake.RequestText gibberishLevel totalSentences |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile does not return a null when using desktop-clock-info`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFile gibberishLevel totalSentences DesktopClock |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile does not return a null when using console-waterworks-announcement`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFile gibberishLevel totalSentences ConsoleWaterworks |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile does not return a null when using word-generator`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFile gibberishLevel totalSentences WordGenerator |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTestFromFile does not generate a null when using test-post`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFile gibberishLevel totalSentences TestPost |
||||
Assert.NotNull result |
||||
|
||||
module ``File Access Tests`` = |
||||
|
||||
(* 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. *) |
||||
|
||||
[<Fact>] |
||||
let ``desktop-clock-info can be found`` () = |
||||
let result = File.Exists DesktopClock |
||||
Assert.Equal(true, result); |
||||
|
||||
[<Fact>] |
||||
let ``console-waterworks-announcements can be found`` () = |
||||
let result = File.Exists ConsoleWaterworks |
||||
Assert.Equal(true, result); |
||||
|
||||
[<Fact>] |
||||
let ``word-generator can be found`` () = |
||||
let result = File.Exists WordGenerator |
||||
Assert.Equal(true, result); |
||||
|
||||
[<Fact>] |
||||
let ``test-post can be found`` () = |
||||
let result = File.Exists TestPost |
||||
Assert.Equal(true, result) |
||||
|
||||
module ``Null Tests`` = |
||||
|
||||
[<Fact>] |
||||
let ``RequestRandomText does not return a null`` () = |
||||
let result = Pancake.RequestRandomTextAsync () |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestText does not return a null`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result () = Pancake.RequestTextAsync gibberishLevel totalSentences |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile does not return a null when using desktop-clock-info`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFileAsync gibberishLevel totalSentences DesktopClock |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile does not return a null when using console-waterworks-announcement`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFileAsync gibberishLevel totalSentences ConsoleWaterworks |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile does not return a null when using word-generator`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFileAsync gibberishLevel totalSentences WordGenerator |
||||
Assert.NotNull result |
||||
|
||||
[<Fact>] |
||||
let ``RequestTestFromFile does not generate a null when using test-post`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = Pancake.RequestTextFromFileAsync gibberishLevel totalSentences TestPost |
||||
Assert.NotNull result |
||||
|
||||
module ``Contents Tests`` = |
||||
|
||||
[<Fact>] |
||||
let ``RequestRandomText returns a string which contains a full stop`` () = |
||||
let result = |
||||
Pancake.RequestRandomTextAsync () |
||||
|> Async.RunSynchronously |
||||
Assert.Contains(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestText returns a string which contains a full stop`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextAsync gibberishLevel totalSentences |
||||
|> Async.RunSynchronously |
||||
Assert.Contains(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a string which contains a full stop when using console-waterworks-announcement`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences ConsoleWaterworks |
||||
|> Async.RunSynchronously |
||||
Assert.Contains(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a string which contains a full stop when using desktop-clock-info`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences DesktopClock |
||||
|> Async.RunSynchronously |
||||
Assert.Contains(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a string which contains a full stop when using test-post`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences TestPost |
||||
|> Async.RunSynchronously |
||||
Assert.Contains(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a string which contains a full stop when using word-generator`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences WordGenerator |
||||
|> Async.RunSynchronously |
||||
Assert.Contains(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestRandomText returns a string which ends with a full stop`` () = |
||||
let result = |
||||
Pancake.RequestRandomTextAsync () |
||||
|> Async.RunSynchronously |
||||
Assert.EndsWith(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestText returns a string which ends with a full stop`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextAsync gibberishLevel totalSentences |
||||
|> Async.RunSynchronously |
||||
Assert.EndsWith(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a string which ends with a full stop when using console-waterworks-announcement`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences ConsoleWaterworks |
||||
|> Async.RunSynchronously |
||||
Assert.EndsWith(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a sting which ends with a full stop when using desktop-clock-info`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences DesktopClock |
||||
|> Async.RunSynchronously |
||||
Assert.EndsWith(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a sting which ends with a full stop when using test-post`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences TestPost |
||||
|> Async.RunSynchronously |
||||
Assert.EndsWith(".", result) |
||||
|
||||
[<Fact>] |
||||
let ``RequestTextFromFile returns a sting which ends with a full stop when using word-generator`` () = |
||||
let gibberishLevel = System.Random().Next(2, 20) |
||||
let totalSentences = System.Random().Next(2, 20) |
||||
let result = |
||||
Pancake.RequestTextFromFileAsync gibberishLevel totalSentences WordGenerator |
||||
|> Async.RunSynchronously |
||||
Assert.EndsWith(".", result) |
Loading…
Reference in new issue