public void ShouldSortArray() { var input = new string[] { "def", "abc" }; var sorted = WordsSorter.Sort(input); Assert.AreEqual("abc", sorted[0]); Assert.AreEqual("def", sorted[1]); }
public string CountWords(string document) { var input = CharacterRemover.RemoveDots(document); var allWords = input.Split(null).Where(w => !string.IsNullOrEmpty(w)); var onlyRealWords = CharacterRemover.RemoveNumbers(allWords.ToArray()); var sortedWords = WordsSorter.Sort(onlyRealWords); var builder = new OutputBuilder(sortedWords); return(builder.Build()); }
public void ShouldNotRearrangeSortedArray() { var input = new string[] { "abc", "def", "ghi" }; var sorted = WordsSorter.Sort(input); Assert.AreEqual("abc", sorted[0]); Assert.AreEqual("def", sorted[1]); Assert.AreEqual("ghi", sorted[2]); }