Beispiel #1
0
        public void FindWordsFromLetters_ForVarietyOfWords_ReturnsListOfFoundWords(IEnumerable <char> letters, IEnumerable <string> expectedResults)
        {
            // ACT
            var results = _wordFinder.FindWordsFromLetters(letters).ToList();

            // ASSERT
            Assert.Equal(expectedResults.Count(), results.Count());

            foreach (var expectedResult in expectedResults)
            {
                Assert.Contains(expectedResult, results);
            }
        }
        public IDictionary <int, List <string> > Solve(char[] letters)
        {
            var matchedWords = _wordFinder.FindWordsFromLetters(letters);

            return(matchedWords
                   .GroupBy(x => x.Length)
                   .ToDictionary(g => g.Key, g => g.ToList()));
        }