예제 #1
0
        public void TextToFormattedArray_TextWasCorrectlyFormattedToArray()
        {
            ArrayFormat arrayFormat = new ArrayFormat();
            string      fileName    = System.IO.Directory.GetCurrentDirectory().Replace(@"ExerciseOrderBy.Tests\bin\Debug", @"\ExerciseOrderBy\input.txt");

            string lowerText = System.IO.File.ReadAllText(fileName).ToLower();

            string[] formattedArray = arrayFormat.TextToFormattedArray(lowerText);

            Assert.AreEqual("String[]", formattedArray.GetType().Name, "String was not correctly convert to array");
        }
예제 #2
0
        public void OrderByAscending_StringArrayWasCorrectlyOrderedByAscending()
        {
            ArrayFormat arrayFormat = new ArrayFormat();
            string      fileName    = System.IO.Directory.GetCurrentDirectory().Replace(@"ExerciseOrderBy.Tests\bin\Debug", @"\ExerciseOrderBy\input.txt");

            string lowerText = System.IO.File.ReadAllText(fileName).ToLower();

            string[] formattedArray = arrayFormat.TextToFormattedArray(lowerText);
            string[] orderedArray   = arrayFormat.OrderByAscending(formattedArray);

            Assert.IsTrue(arrayFormat.IsAlphabeticallySorted(orderedArray), "String is not alphabetically ordered after method execution");
        }