public void TranslatorReturnsCorrectText()
        {
            // Arrange
            string word = _dict.GetRandomWordKey();

            // Act
            Word translation = _translator.Translate(word);

            // Assert
            Assert.AreEqual(_dict[word].Text, translation.Text);
        }
Example #2
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);
        }