|
|
|
@ -12,19 +12,19 @@
|
|
|
|
|
let GibberishLevelIsValid gibberishLevel = |
|
|
|
|
match gibberishLevel with |
|
|
|
|
| gibberishLevel when gibberishLevel < 2 || gibberishLevel > 20 -> |
|
|
|
|
raise (new ArgumentException("Invalid argument. Must be between 2 and 20 (inclusive).", "gibberishLevel")) |
|
|
|
|
invalidArg "gibberishLevel" "Invalid argument. Must be between 2 and 20 (inclusive)." |
|
|
|
|
| _ -> ignore |
|
|
|
|
|
|
|
|
|
let SentencesIsValid sentences = |
|
|
|
|
match sentences with |
|
|
|
|
| sentences when sentences < 1 -> |
|
|
|
|
raise (ArgumentException("Invalid argument. Must be greater than 0.", "sentences")) |
|
|
|
|
invalidArg "sentences" "Invalid argument. Must be greater than 0." |
|
|
|
|
| _ -> ignore |
|
|
|
|
|
|
|
|
|
let FilePathIsValid filePath = |
|
|
|
|
match filePath with |
|
|
|
|
| filePath when Path.GetExtension filePath <> ".txt" -> |
|
|
|
|
raise (ArgumentException("Invalid argument. File must be a .txt file.","filePath")) |
|
|
|
|
invalidArg "filePath" "Invalid argument. File must be a .txt file." |
|
|
|
|
| filePath when not (File.Exists filePath) -> |
|
|
|
|
raise (FileNotFoundException("Unable to find the file at the location specified.")) |
|
|
|
|
| _ -> ignore |
|
|
|
|