public void Example_FindsExpectedWords() { AnagramFinder finder = new AnagramFinder(); List <string> results = finder.FindAnagram("teen nine"); Assert.AreEqual("nineteen", results[0]); }
public void ExampleWithNoResults_ReturnsEmptyList() { AnagramFinder finder = new AnagramFinder(); // ReSharper disable StringLiteralTypo List <string> results = finder.FindAnagram("hitittttt"); // ReSharper restore StringLiteralTypo Assert.AreEqual(0, results.Count); }
public void Example_ReturnsListSortedByLength() { AnagramFinder finder = new AnagramFinder { MinimumWordLength = 2 }; List <string> results = finder.FindAnagram("teen nine"); Assert.AreEqual(12, results.Count); int previousWordLength = results[0].Length; foreach (string word in results) { Assert.LessOrEqual(word.Length, previousWordLength, $"Expected {word} to have length less than {previousWordLength}, but it has length {word.Length}"); previousWordLength = word.Length; } }