示例#1
0
        public void ShouldSortArray()
        {
            var input = new string[] { "def", "abc" };

            var sorted = WordsSorter.Sort(input);

            Assert.AreEqual("abc", sorted[0]);
            Assert.AreEqual("def", sorted[1]);
        }
示例#2
0
        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());
        }
示例#3
0
        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]);
        }