示例#1
0
文件: Program.cs 项目: lesley86/Ozow
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter the string you wish to sort.");
            var input        = Console.ReadLine();
            var sortedString = new CustomTextSort().Sort(input);

            Console.WriteLine(sortedString);
        }
示例#2
0
        public void ShouldSortStringAlphabetically()
        {
            var stringSorter = new CustomTextSort();
            var result       = stringSorter.Sort("Contrary to popular belief, the pink unicorn flies east.");
            var expected     = "aaabcceeeeeffhiiiiklllnnnnooooppprrrrssttttuuy";

            for (int resultIndex = 0; resultIndex < result.Length; resultIndex++)
            {
                char.Equals(result[0], expected[0]);
            }
        }
示例#3
0
        public void ShouldThrowArgumentExceptionIfNoLettersInString()
        {
            var stringSorter = new CustomTextSort();

            Assert.Throws <ArgumentException>(() => stringSorter.Sort("1231865465"));
        }
示例#4
0
        public void ShouldThrowArgumentExceptionIfEmptyString()
        {
            var stringSorter = new CustomTextSort();

            Assert.Throws <ArgumentException>(() => stringSorter.Sort(""));
        }