Beispiel #1
0
        public void SuggestionServiceReturnsCorrectSimilarWords()
        {
            // Arrange
            string input          = _dict.GetRandomWordKey();
            var    expectedValues = _dict.Values.Where(w => w.Links.Any(wl => string.Equals(wl.Text, input)))
                                    .SelectMany(w => w.Links)
                                    .Select(w => w.Text)
                                    .Where(wt => !string.Equals(wt, input))
                                    .GroupBy(w => w)
                                    .OrderByDescending(w => w.Count())
                                    .Select(w => w.Key)
                                    .ToList();
            // Act
            var actualValues = _suggestionService.GetSimilarWords(input);

            // Assert
            CollectionAssert.AreEqual(expectedValues, actualValues);
        }