public void Given4x4WordWithTwoUpWordsPuzzleWhenCallingSearchEachWordsThenSearchEachWordReturnsAStringVector2DictionaryWithEntryForKIRKAndKHAN(WordSearchPuzzle puzzle, Dictionary <String, List <Vector2> > expected)
        {
            puzzle.AddWord("KHAN");

            DirectionSearchFactory directionSearchFactory = new DirectionSearchFactory(puzzle);

            sut = new WordSearchAlgorithm(directionSearchFactory, puzzle.WordsList);

            Dictionary <String, List <Vector2> > result = sut.SearchEachWord();

            List <Vector2> khanLocation = new List <Vector2>();

            khanLocation.Add(new Vector2(3, 3));
            khanLocation.Add(new Vector2(3, 2));
            khanLocation.Add(new Vector2(3, 1));
            khanLocation.Add(new Vector2(3, 0));
            expected.Add("KHAN", khanLocation);

            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
        private WordSearchPuzzle KIRKUpInFirstColumnPuzzle()
        {
            WordSearchPuzzle puzzle = new WordSearchPuzzle();

            puzzle.AddWord("KIRK");
            puzzle.AddLetterAt('K', 0, 0);
            puzzle.AddLetterAt('E', 1, 0);
            puzzle.AddLetterAt('F', 2, 0);
            puzzle.AddLetterAt('N', 3, 0);
            puzzle.AddLetterAt('R', 0, 1);
            puzzle.AddLetterAt('R', 1, 1);
            puzzle.AddLetterAt('J', 2, 1);
            puzzle.AddLetterAt('A', 3, 1);
            puzzle.AddLetterAt('I', 0, 2);
            puzzle.AddLetterAt('L', 1, 2);
            puzzle.AddLetterAt('I', 2, 2);
            puzzle.AddLetterAt('H', 3, 2);
            puzzle.AddLetterAt('K', 0, 3);
            puzzle.AddLetterAt('D', 1, 3);
            puzzle.AddLetterAt('J', 2, 3);
            puzzle.AddLetterAt('M', 3, 3);

            return(puzzle);
        }
Exemplo n.º 3
0
 public void GivenWordSearchPuzzleWhenAddWordIsPassedAStringThenAddWordThrowsNoException()
 {
     sut.AddWord("PILLAR");
 }