Beispiel #1
0
            public void SIS_ReturnsNonEmptyList()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle();
                var results             = puzzle.FindAllWordsThatStartWith("sis");

                Assert.Less(0, results.Count, "Expected at least one word to be returned.");
            }
Beispiel #2
0
            public void SOCK_NoWordsStartWithCK_ReturnsExpectedResults()
            {
                HiddenWordPuzzle puzzle  = new HiddenWordPuzzle();
                List <string>    results = puzzle.GenerateAllSplitableStrings("sock");

                CollectionAssert.AreEquivalent(new List <string>(), results);
            }
Beispiel #3
0
            public void CreatesExpectedLists()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle();

                CollectionAssert.AreEquivalent(new[] { 1, 2 }, puzzle.GenerateWordBreaks(3));
                CollectionAssert.AreEquivalent(new[] { 1, 2, 3 }, puzzle.GenerateWordBreaks(4));
                CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4 }, puzzle.GenerateWordBreaks(5));
                CollectionAssert.AreEquivalent(new[] { 1, 2, 3, 4, 5 }, puzzle.GenerateWordBreaks(6));
            }
Beispiel #4
0
            public void AIN_IncludesA()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle {
                    Solution = "domain"
                };
                var results = puzzle.FindWordsAtTheStartOfThisString("ain");

                CollectionAssert.Contains(results, "a");
            }
Beispiel #5
0
            public void SOCK_GeneratesNoPuzzles()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle();
                //puzzle.RandomSeed = 1;

                List <string> words = puzzle.HideWord("sock");

                Console.WriteLine(string.Join(','.ToString(), words));
                Assert.AreEqual(0, words.Count);
            }
Beispiel #6
0
            public void LONE_ReturnsExpectedSplitableStrings()
            {
                HiddenWordPuzzle puzzle          = new HiddenWordPuzzle();
                List <string>    results         = puzzle.GenerateAllSplitableStrings("lone");
                List <string>    expectedStrings = new List <string> {
                    "l.one", "lo.ne", "lon.e", //Single dot
                    "l.on.e"                   //double dot
                };

                CollectionAssert.AreEquivalent(expectedStrings, results);
            }
Beispiel #7
0
            public void DOMAIN_ReturnsExpectedResult()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle {
                    Solution = "domain"
                };
                var splitableStrings = new List <string>();

                puzzle.ProcessRemainingLetters("domain", "ain", new StringBuilder("dom."), splitableStrings);
                CollectionAssert.Contains(splitableStrings, "dom.a.i.n")
                ;
            }
Beispiel #8
0
            public void ThreeDots_ReturnsExpectedValue()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle()
                {
                    RandomSeed = 1
                };

                Assert.AreEqual(new List <string> {
                    "halo", "a", "sister"
                }, puzzle.CreateSpecificExampleFromSplitableString("o.a.sis"));
            }
Beispiel #9
0
            public void TEST_ReturnsExpectedSplitableStrings()
            {
                HiddenWordPuzzle puzzle          = new HiddenWordPuzzle();
                List <string>    results         = puzzle.GenerateAllSplitableStrings("test");
                List <string>    expectedStrings = new List <string> {
                    //"t.est",  //no word starts with est.
                    "te.st",
                    "tes.t"
                };

                CollectionAssert.AreEquivalent(expectedStrings, results);
            }
Beispiel #10
0
            public void TEST_GeneratesExpectedWords()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle {
                    RandomSeed = 1
                };

                List <string> words = puzzle.HideWord("test");

                Console.WriteLine(string.Join(','.ToString(), words));
                Assert.AreEqual("fate", words[0]);
                Assert.AreEqual("stirs", words[1]);
                Assert.AreEqual(2, words.Count);
            }
Beispiel #11
0
            public void DOMAIN_ReturnsExpectedSplitableStrings()
            {
                HiddenWordPuzzle puzzle          = new HiddenWordPuzzle();
                List <string>    results         = puzzle.GenerateAllSplitableStrings("domain");
                List <string>    expectedStrings = new List <string>
                {
                    "do.main",  //one dot
                    "dom.a.in", //two dots
                    "dom.a.i.n" //three dots
                };

                CollectionAssert.AreEquivalent(expectedStrings, results);
            }
Beispiel #12
0
            public void SingleSentence_ReturnsExpectedString()
            {
                const string EXPECTED_TEXT =
                    @"One word in each sentence below is hidden elsewhere in the sentence.
Find the word, and then write the first letter of that word into the blanks below.
1. Example Sentence
Solution: _ _ .
";
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle {
                    RandomSeed = 1, Solution = "ca."
                };

                puzzle.Sentences.Add("Example Sentence");
                Assert.AreEqual(EXPECTED_TEXT, puzzle.FormatPuzzleAsText());
            }
Beispiel #13
0
            public void ONION_ReturnsExpectedSplitableStrings()
            {
                HiddenWordPuzzle puzzle          = new HiddenWordPuzzle();
                List <string>    results         = puzzle.GenerateAllSplitableStrings("onion");
                List <string>    expectedStrings = new List <string>
                {
                    // ReSharper disable CommentTypo
                    //"o.nion",//No words start with "nion"
                    "on.ion",
                    //"oni.on", //No word starts with 'oni'
                    //"onio.n", //
                    "on.i.on",  //double dot.
                    // ReSharper restore CommentTypo
                };

                CollectionAssert.AreEquivalent(expectedStrings, results);
            }
Beispiel #14
0
            public void O_A_SIS_ReturnsExpectedValue()
            {
                HiddenWordPuzzle puzzle = new HiddenWordPuzzle();

                Assert.IsTrue(puzzle.VerifySplitableStringCandidate("o.a.sis")); //Initially false because no words start with 'sis'.
            }