Example #1
0
 private void searchToolStripMenuItem_Click(object sender, EventArgs e)
 {
     searchEngine = SearchEngineFactory.Get(this.searchEngineData);
     searchEngine.BoxesBeingSearched += SearchEngineBoxesBeingSearched;
     searchEngine.FoundWord          += SearchEngineFoundWord;
     this.ClearFormState();
     SetButtonStateToOperating();
     workerThread.RunWorkerAsync();
 }
Example #2
0
        public void SearchEngineFindsExpectedWordsInTestData(string testName)
        {
            // arrange
            var data         = new WordSearchResourceData(testName);
            var searchEngine = SearchEngineFactory.Get(data);

            // act
            searchEngine.CheckAllPossibleWords();
            var wordsNotFound = data.ExpectedWords.Where(expectedWord => !searchEngine.FoundWords.Contains(expectedWord)).ToList();

            // assert
            Assert.IsEmpty(wordsNotFound, "Expected words weren't found", wordsNotFound);
        }
Example #3
0
        public void SearchEngineWordsAreNotFound(string letters, int width, string[] expectedWords)
        {
            // arrange
            var data         = new SearchEngineData(letters, width, expectedWords);
            var searchEngine = SearchEngineFactory.Get(data);

            // act
            searchEngine.CheckAllPossibleWords();
            var wordsNotFound = data.ExpectedWords.Where(expectedWord => !searchEngine.FoundWords.Contains(expectedWord)).ToList();

            // assert
            Assert.IsNotEmpty(wordsNotFound, "All words were found");
        }
Example #4
0
        public void RunWholeSearchEngineUsingTestDataAndJustOutput(string testName)
        {
            // arrange
            var data          = new WordSearchResourceData(testName);
            var searchEngine  = SearchEngineFactory.Get(data);
            var resultsOutput = new SearchResultsOutput();

            searchEngine.BoxesBeingSearched += resultsOutput.OutputBoxesBeingSearched;
            searchEngine.FoundWord          += resultsOutput.OutputFoundWord;

            // act
            searchEngine.CheckAllPossibleWords();

            // assert
            resultsOutput.OutputAllFoundWords(searchEngine.FoundWords);
        }