private void searchToolStripMenuItem_Click(object sender, EventArgs e) { searchEngine = SearchEngineFactory.Get(this.searchEngineData); searchEngine.BoxesBeingSearched += SearchEngineBoxesBeingSearched; searchEngine.FoundWord += SearchEngineFoundWord; this.ClearFormState(); SetButtonStateToOperating(); workerThread.RunWorkerAsync(); }
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); }
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"); }
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); }