Browse Source

Refactored tests.

Fixed the end of sentence bug.
Cleaned up some of the .txt files.
master
Craig Oates 6 years ago
parent
commit
59d1dbc319
  1. 101
      TestCentre/PropertyTests.fs
  2. 16
      TestCentre/TestCentre.fsproj
  3. 21
      TestCentre/TextFiles/desktop-clock-info.txt
  4. 4
      TestCentre/TextFiles/test-post.txt
  5. 2
      WetPancake/DataServices.fs
  6. 10
      WetPancake/TextFiles/desktop-clock-info.txt
  7. 4
      WetPancake/TextFiles/test-post.txt
  8. 16
      WetPancake/WetPancake.fsproj

101
TestCentre/PropertyTests.fs

@ -22,18 +22,18 @@
[<Property>]
let ``Request Text does not return a null when using fixed input parameters`` () =
// Change the values for a quick way to manually test the (test) code.
let test =
let test ()=
Pancake.RequestTextAsync 5 5
|> Async.RunSynchronously
let results = Assert.NotNull test
let results = Assert.NotNull (test())
Check.Quick results
[<Property>]
let ``Request Text does not return a null when using a random gibberish level`` () =
let test =
let test ()=
Pancake.RequestTextAsync (ValidGibberishLevelInput()) 5
|> Async.RunSynchronously
let results = Assert.NotNull test
let results = Assert.NotNull (test())
Check.Quick results
[<Property>]
@ -45,156 +45,147 @@
Check.Quick results
[<Property>]
let ``Using desktop-clock-info does not return a null`` () =
let test =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) DesktopClock
let ``RequestTextFromFile does not return a null when using console-waterworks-info`` () =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) ConsoleWaterworks
|> Async.RunSynchronously
let results = Assert.NotNull test
let results = Assert.NotNull (test())
Check.Quick results
[<Property>]
let ``Using console-waterworks-announcement does not return a null`` () =
let test =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) ConsoleWaterworks
let ``RequestTextFromFile does not return a null when using desktop-clock-info`` () =
let test ()=
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) DesktopClock
|> Async.RunSynchronously
let results = Assert.NotNull test
let results = Assert.NotNull (test())
Check.Quick results
[<Property>]
let ``Using word-generator does not return a null`` () =
let test =
let ``RequestTextFromFile does not return a null when using word-generator`` () =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) WordGenerator
|> Async.RunSynchronously
let results = Assert.NotNull test
let results = Assert.NotNull (test())
Check.Quick results
[<Property>]
let ``Using test-post does not return a null`` () =
let test =
let ``RequestTextFromFile does not return a null when using test-post`` () =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) TestPost
|> Async.RunSynchronously
let results = Assert.NotNull test
let results = Assert.NotNull (test())
Check.Quick results
[<Property>]
let ``RequestAllTemplateFiles does not return a null`` () =
let test =
let test () =
Pancake.RequestAllTemplateFilesAsync ()
|> Async.RunSynchronously
let results = Assert.NotNull test
let results = Assert.NotNull (test())
Check.Quick results
module ``Contents Test`` =
[<Property>]
let ``RequestRandomText returns a string which contains a full stop`` () =
let test =
let test () =
Pancake.RequestRandomTextAsync ()
|> Async.RunSynchronously
let results = Assert.Contains(".", test)
let results = Assert.Contains(".", test())
Check.Quick results
[<Property>]
let ``RequestText returns a string which contains a full stop`` () =
let test =
let test () =
Pancake.RequestTextAsync (ValidGibberishLevelInput()) (ValidSentencesInput())
|> Async.RunSynchronously
let results = Assert.Contains(".", test)
let results = Assert.Contains(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which contains a full stop when using console-waterworks-announcement`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) ConsoleWaterworks
|> Async.RunSynchronously
let results = Assert.Contains(".", test)
let results = Assert.Contains(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which contains a full stop when using desktop-clock-info`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) DesktopClock
|> Async.RunSynchronously
let results = Assert.Contains(".", test)
let results = Assert.Contains(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which contains a full stop when using test-post`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) TestPost
|> Async.RunSynchronously
let results = Assert.Contains(".", test)
let results = Assert.Contains(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which contains a full stop when using word-generator`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) WordGenerator
|> Async.RunSynchronously
let results = Assert.Contains(".", test)
let results = Assert.Contains(".", test())
Check.Quick results
[<Property>]
let ``RequestRandomText returns a string which ends with a full stop`` () =
let test =
let test () =
Pancake.RequestRandomTextAsync ()
|> Async.RunSynchronously
let results = Assert.EndsWith(".", test)
let results = Assert.EndsWith(".", test())
Check.Quick results
[<Property>]
let ``RequestTest returns a string which ends with a full stop`` () =
let test =
let test () =
Pancake.RequestTextAsync (ValidGibberishLevelInput()) (ValidSentencesInput())
|> Async.RunSynchronously
let results = Assert.EndsWith(".", test)
let results = Assert.EndsWith(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which ends with a full stop when using console-waterwork-announcement`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) ConsoleWaterworks
|> Async.RunSynchronously
let results = Assert.EndsWith(".", test)
let results = Assert.EndsWith(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which ends with a full stop when using desktop-clock-info`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) DesktopClock
|> Async.RunSynchronously
let results = Assert.EndsWith(".", test)
let results = Assert.EndsWith(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which ends with a full stop when using test-post`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) TestPost
|> Async.RunSynchronously
let results = Assert.EndsWith(".", test)
let results = Assert.EndsWith(".", test())
Check.Quick results
[<Property>]
let ``RequestTextFromFile returns a string which ends with a full stop when using word-generator`` () =
let test =
let test () =
Pancake.RequestTextFromFileAsync (ValidGibberishLevelInput()) (ValidSentencesInput()) WordGenerator
|> Async.RunSynchronously
let results = Assert.EndsWith(".", test)
let results = Assert.EndsWith(".", test())
Check.Quick results
[<Property>]
let ``RequestAllTemplateFiles does not return an empty list`` () =
let test =
let test () =
Pancake.RequestAllTemplateFilesAsync ()
|> Async.RunSynchronously
let results = Assert.NotEmpty test
let results = Assert.NotEmpty (test())
Check.Quick results

16
TestCentre/TestCentre.fsproj

@ -55,10 +55,6 @@
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<ItemGroup>
<Content Include="TextFiles\desktop-clock-info.txt" />
<Content Include="TextFiles\console-waterworks-announcement.txt" />
<Content Include="TextFiles\word-generator.txt" />
<Content Include="TextFiles\test-post.txt" />
<Compile Include="AssemblyInfo.fs" />
<Compile Include="TestingConstants.fs" />
<Compile Include="InputGeneration.fs" />
@ -66,6 +62,18 @@
<Compile Include="PropertyTests.fs" />
<None Include="Script.fsx" />
<Content Include="packages.config" />
<Content Include="TextFiles\console-waterworks-announcement.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TextFiles\word-generator.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TextFiles\test-post.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TextFiles\desktop-clock-info.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Reference Include="FsCheck">

21
TestCentre/TextFiles/desktop-clock-info.txt

@ -1,14 +1,17 @@
About Desktop Clock
This is a basic WPF program which displays the data and time so it is readable from a distance.
Desktop Clock uses a NuGet package called This allows the program to look like a Windows 10 UWP program.
The most notable aspects being the translucent chrome and the highlighting of near-by buttons.
Screenshot 1 Desktop Clock is a WPF program which looks like a UWP program.
This is a basic WPF program which displays the data and time so it is readable from a distance. Desktop Clock uses a NuGet package called This allows the program to look like a Windows 10 UWP program. The most notable aspects being the translucent chrome and the highlighting of near-by buttons.
Screenshot 1 Desktop Clock is a WPF program which looks like a UWP program.Publishing Information
If you would like to use, it you will need to build from the source code provided. I did not want to mess around with ClickOnce or any other packaging mechanism.
If you would like to use, it you will need to build from the source code provided.
I did not want to mess around with ClickOnce or any other packaging mechanism.
With it being a WPF program, it can run on Windows 7 and 8 machines.
Future Plans
I do not intend to take this any further. It is a simple program which I have running 247, floating about on the screen. It sits there and does what I need it to do. Anything else seems like overkill and I do not find myself wanting it to do something extra. Therefore, if you want something adding to it, I recommend you fork it.
GitHub
I do not intend to take this any further.
It is a simple program which I have running 247, floating about on the screen.
It sits there and does what I need it to do.
Anything else seems like overkill and I do not find myself wanting it to do something extra.
Therefore, if you want something adding to it, I recommend you fork it.
Desktop Clock is  available on GitHub. Feel free to check it out, download it or fork it
Desktop Clock is available on GitHub. Feel free to check it out, download it or fork it.

4
TestCentre/TextFiles/test-post.txt

@ -8,6 +8,4 @@ Wow, you really are sticking around, aren't you? Hmm... okay... I guess I should
Let me begin by offering you a sincere "Hello and how are you today?" I hope the weather is nice when and where you are. There is something about it which can make or break a day. The tussle between working with and against it can leave a mark on the soul. But, there is a certain type of comfort to be had when you acknowledge it will always win against the human race. Jammy dodger? Would you like sugar in your tea?
Is that the doorbell? Excuse me, I'm just going to see whom it is -- or is it who?
...
Is that the doorbell? Excuse me, I'm just going to see whom it is -- or is it who?

2
WetPancake/DataServices.fs

@ -15,7 +15,7 @@
let rec GenerateMarkovChain (map: Map<string, string List>) (state:string) chain =
if map.ContainsKey state then
let nextChoice = map.[state] |> PickRandomItem
if MatchText @"\." nextChoice then nextChoice :: chain
if MatchText @"$\." nextChoice then nextChoice :: chain
else
let currentWords =
state

10
WetPancake/TextFiles/desktop-clock-info.txt

@ -1,14 +1,10 @@
About Desktop Clock
This is a basic WPF program which displays the data and time so it is readable from a distance. Desktop Clock uses a NuGet package called This allows the program to look like a Windows 10 UWP program. The most notable aspects being the translucent chrome and the highlighting of near-by buttons.
Screenshot 1 Desktop Clock is a WPF program which looks like a UWP program.Publishing Information
This is a basic WPF program which displays the data and time so it is readable from a distance. Desktop Clock uses a NuGet package called This allows the program to look like a Windows 10 UWP program. The most notable aspects being the translucent chrome and the highlighting of near-by buttons.
Screenshot 1 Desktop Clock is a WPF program which looks like a UWP program.
If you would like to use, it you will need to build from the source code provided. I did not want to mess around with ClickOnce or any other packaging mechanism.
With it being a WPF program, it can run on Windows 7 and 8 machines.
Future Plans
I do not intend to take this any further. It is a simple program which I have running 247, floating about on the screen. It sits there and does what I need it to do. Anything else seems like overkill and I do not find myself wanting it to do something extra. Therefore, if you want something adding to it, I recommend you fork it.
GitHub
Desktop Clock is  available on GitHub. Feel free to check it out, download it or fork it
Desktop Clock is  available on GitHub. Feel free to check it out, download it or fork it.

4
WetPancake/TextFiles/test-post.txt

@ -8,6 +8,4 @@ Wow, you really are sticking around, aren't you? Hmm... okay... I guess I should
Let me begin by offering you a sincere "Hello and how are you today?" I hope the weather is nice when and where you are. There is something about it which can make or break a day. The tussle between working with and against it can leave a mark on the soul. But, there is a certain type of comfort to be had when you acknowledge it will always win against the human race. Jammy dodger? Would you like sugar in your tea?
Is that the doorbell? Excuse me, I'm just going to see whom it is -- or is it who?
...
Is that the doorbell? Excuse me, I'm just going to see whom it is -- or is it who?

16
WetPancake/WetPancake.fsproj

@ -51,10 +51,18 @@
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<ItemGroup>
<Content Include="TextFiles\desktop-clock-info.txt" />
<Content Include="TextFiles\console-waterworks-announcement.txt" />
<Content Include="TextFiles\word-generator.txt" />
<Content Include="TextFiles\test-post.txt" />
<Content Include="TextFiles\desktop-clock-info.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TextFiles\console-waterworks-announcement.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TextFiles\word-generator.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TextFiles\test-post.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="SystemServices.fs" />
<Compile Include="DataAccess.fs" />

Loading…
Cancel
Save