Пример #1
0
        static int Main(string[] args)
        {
            try
            {
                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine("*******************************************************************");
                Console.WriteLine("*******************************************************************");

                ReadProgress();

                string koan_path = args[0];
                Xunit.ExecutorWrapper      wrapper = new ExecutorWrapper(koan_path, null, false);
                System.Reflection.Assembly koans   = System.Reflection.Assembly.LoadFrom(koan_path);
                if (koans == null)
                {
                    Console.WriteLine("Bad Assembly"); return(-1);
                }
                Type pathType = null;
                foreach (Type type in koans.GetExportedTypes())
                {
                    if (typeof(KoanHelpers.IAmThePathToEnlightenment).IsAssignableFrom(type))
                    {
                        pathType = type;
                        break;
                    }
                }

                KoanHelpers.IAmThePathToEnlightenment path = Activator.CreateInstance(pathType) as KoanHelpers.IAmThePathToEnlightenment;
                string   thePath      = path.ThePath;
                string[] theKoanNames = KoanNames;

                foreach (string koanName in theKoanNames)
                {
                    Run(thePath + "." + koanName, koans, wrapper);
                }

                Console.WriteLine("{0}", Encouragement());
                progress.Add(firstFailingKoan);
                WriteProgress();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Karma has killed the runner. Exception was: " + ex.ToString());
                return(-1);
            }
            if (!aKoanHasFailed)
            {
                firstFailingKoan = numberKoansProcessed;
            }
            Console.WriteLine("Koan progress: {0}/{1}", firstFailingKoan, numberKoansProcessed);
            Console.WriteLine("*******************************************************************");
            Console.WriteLine("*******************************************************************");
            Console.WriteLine("");
            Console.WriteLine("");
            return(0);
        }
Пример #2
0
        static int Main(string[] args)
        {
            StringBuilder progress = new StringBuilder();

            try
            {
                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine("*******************************************************************");
                Console.WriteLine("*******************************************************************");
                string koan_path = args[0];
                Xunit.ExecutorWrapper      wrapper = new ExecutorWrapper(koan_path, null, false);
                System.Reflection.Assembly koans   = System.Reflection.Assembly.LoadFrom(koan_path);
                if (koans == null)
                {
                    Console.WriteLine("Bad Assembly"); return(-1);
                }
                Type pathType = null;
                foreach (Type type in koans.GetExportedTypes())
                {
                    if (typeof(KoanHelpers.IAmThePathToEnlightenment).IsAssignableFrom(type))
                    {
                        pathType = type;
                        break;
                    }
                }

                KoanHelpers.IAmThePathToEnlightenment path = Activator.CreateInstance(pathType) as KoanHelpers.IAmThePathToEnlightenment;
                string[] thePath = path.ThePath;

                foreach (string koan in thePath)
                {
                    progress.AppendFormat("{0},", Run(koan, koans, wrapper));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Karma has killed the runner. Exception was: " + ex.ToString());
                return(-1);
            }
            Console.WriteLine("Koan progress:{0}", progress.ToString());
            Console.WriteLine("*******************************************************************");
            Console.WriteLine("*******************************************************************");
            Console.WriteLine("");
            Console.WriteLine("");
            return(TEST_FAILED);
        }