Example #1
0
        public void GivenValidOneWordWordsMapDictionaryWhenCallingToStringThenToStringReturnsAString(Dictionary <String, List <Vector2> > wordsMap)
        {
            sut = new WordsMapDecorator(wordsMap);

            String result = sut.ToString();

            Assert.IsInstanceOf(typeof(String), result);
        }
Example #2
0
        public void GivenValidOneWordWordsMapDictionaryWhenCallingIsValidThenIsValidReturnsTrue(Dictionary <String, List <Vector2> > wordsMap)
        {
            sut = new WordsMapDecorator(wordsMap);

            bool result = sut.IsValid();

            Assert.IsTrue(result);
        }
        public void GivenValidPuzzleWithTwoWordsWhenCallingGetWordsMapThenGetWordsMapReturnsAWordsMapDecoratorWithTwoWords(WordSearchPuzzle puzzle, WordsMapDecorator expected)
        {
            sut = new WordsLocationFinder(puzzle);

            WordsMapDecorator result = sut.GetWordsMap();

            Assert.AreEqual(expected, result);
        }
        public void GivenValidPuzzleWhenCallingGetWordsMapThenGetWordsMapReturnsAWordsMapDecorator(WordSearchPuzzle puzzle)
        {
            sut = new WordsLocationFinder(puzzle);

            WordsMapDecorator result = sut.GetWordsMap();

            Assert.IsInstanceOf <WordsMapDecorator>(result);
        }
        public void GivenAValidStringFileNameContainingAValidWordPuzzleWhenPassedIntoParseFileToWordSearchPuzzleThenResultingWordSearchPuzzleGetWordsListHasTheSolution(Dictionary <String, List <Vector2> > expected)
        {
            WordSearchPuzzle    puzzle      = sut.ParseFileToWordSearchPuzzle(testPuzzlePath + "Example15x15.txt");
            WordsLocationFinder wordsFinder = new WordsLocationFinder(puzzle);
            WordsMapDecorator   result      = wordsFinder.GetWordsMap();

            Assert.AreEqual(expected, result);
        }
Example #6
0
        public void GivenValidOneWordWordsMapDictionaryWhenCallingToStringThenToStringReturnsAStringWithWordsAndTheirLetterLocations(Dictionary <String, List <Vector2> > wordsMap)
        {
            sut = new WordsMapDecorator(wordsMap);

            String result   = sut.ToString();
            String expected = "KIRK: (0,1),(1,1),(2,1),(3,1)";

            Assert.AreEqual(expected, result);
        }
Example #7
0
        public void GivenEmptyWordsMapDictionaryWhenCallingIsValidThenIsValidReturnsFalse()
        {
            Dictionary <String, List <Vector2> > wordsMap = new Dictionary <string, List <Vector2> >();

            sut = new WordsMapDecorator(wordsMap);

            bool result = sut.IsValid();

            Assert.IsFalse(result);
        }
Example #8
0
        public void GivenEmptyWordsMapDictionaryWhenCallingToStringThenToStringReturnsAnEmptyString()
        {
            Dictionary <String, List <Vector2> > wordsMap = new Dictionary <string, List <Vector2> >();

            sut = new WordsMapDecorator(wordsMap);

            String result   = sut.ToString();
            String expected = "";

            Assert.AreEqual(expected, result);
        }
        public void GivenAValidStringFileNameContaingAPuzzleWithOneWordWhenPassedToParseFileToWordSearchPuzzleThenResultingWordSearchPuzzleGetWordsLocationHasTheSolution()
        {
            WordSearchPuzzle    puzzle                  = sut.ParseFileToWordSearchPuzzle(testPuzzlePath + "oneWord4x4.txt");
            WordsLocationFinder wordsFinder             = new WordsLocationFinder(puzzle);
            Dictionary <String, List <Vector2> > result = wordsFinder.GetWordsMap();

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

            kirkLocation.Add(new Vector2(3, 0));
            kirkLocation.Add(new Vector2(2, 0));
            kirkLocation.Add(new Vector2(1, 0));
            kirkLocation.Add(new Vector2(0, 0));
            Dictionary <String, List <Vector2> > wordsLocation = new Dictionary <String, List <Vector2> >();

            wordsLocation.Add("KIRK", kirkLocation);
            WordsMapDecorator expected = new WordsMapDecorator(wordsLocation);

            Assert.AreEqual(expected, result);
        }
Example #10
0
        public void GivenValidOneWordWordsMapDictionaryWhenCallingIsValidThenIsValidThrowsNoException(Dictionary <String, List <Vector2> > wordsMap)
        {
            sut = new WordsMapDecorator(wordsMap);

            sut.IsValid();
        }
Example #11
0
        public void GivenWordsMapDictionaryFinderWhenPassToWordsMapDecoratorConstructorThenThrowNoException()
        {
            Dictionary <String, List <Vector2> > wordsMap = new Dictionary <string, List <Vector2> >();

            sut = new WordsMapDecorator(wordsMap);
        }