Exemple #1
0
        public void sortIntoList()
        {
            isorter sorter = new sorter_bylastname1st();

            var list         = filetext.read(FILE_PATH_SOURCE_EXISTING);
            var actualList   = sorter.sort(list);
            var expectedList = filetext.read(FILE_PATH_TARGET_MASTER);

            CollectionAssert.AreEqual(expectedList, actualList);
        }
Exemple #2
0
        public void sortIntoList_WithSameNamesOrLastNames()
        {
            isorter sorter = new sorter_bylastname1st();

            var list         = filetext.read(FILE_PATH_SOURCE_WITH_SAME_NAMES_OR_LAST_NAMES);
            var actualList   = sorter.sort(list);
            var expectedList = filetext.read(FILE_PATH_TARGET_MASTER_WITH_SAME_NAMES_OR_LAST_NAMES);

            CollectionAssert.AreEqual(expectedList, actualList);
        }
Exemple #3
0
        public void sortIntoFile()
        {
            var sorter = new sorter_bylastname1st();

            if (File.Exists(FILE_PATH_TARGET_EXISTING))
            {
                File.Delete(FILE_PATH_TARGET_EXISTING);
            }
            string message = sorter.sort(FILE_PATH_SOURCE_EXISTING, FILE_PATH_TARGET_EXISTING);

            Assert.AreEqual("SUCCESS", message.Split(' ')[0]);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var sorter = new sorter_bylastname1st();

            sorter.TheResultIsAboutToBeSaved += c_TheResultIsAboutToBeSaved;

            string message = "";

            if (args.Length > 0)
            {
                string filePath = args[0];

                message = sorter.sort(filePath, FILE_PATH_TARGET_DEFAULT);
            }
            else
            {
                message = "ERROR : please provide the source file name";
            }

            Console.WriteLine(message);
            Console.WriteLine("Press any key..");
            Console.ReadKey();
        }