Пример #1
0
        private void build_Vagrant(string testAssembly)
        {
            // Create a list of result
            TestData_Vagrant vagrant = new TestData_Vagrant();

            vagrant.TestAssembly = Path.GetFileName(testAssembly);
            vagrant.Result       = "";

            List <TestData> testData = new List <TestData>();

            foreach (var testOk in passed)
            {
                testData.Add(new TestData()
                {
                    TestName = testOk, Result = true
                });
            }
            foreach (var testBad in failed)
            {
                testData.Add(new TestData()
                {
                    TestName = testBad, Result = false
                });
            }
            // Sort by TestName
            testData.Sort((test1, test2) => test1.TestName.CompareTo(test2.TestName));
            //
            foreach (var td in testData)
            {
                if (td.Result)
                {
                    vagrant.Result += ".";
                }
                else
                {
                    vagrant.Result += "F";
                }
            }
            //
            testData_Vagrant.Add(vagrant);
        }
Пример #2
0
        public void Start()
        {
            if (this.settingEnv.NewMDFile)
            {
                if (File.Exists(this.settingEnv.MDFile))
                {
                    File.Delete(this.settingEnv.MDFile);
                }
            }
            //
            foreach (String assembly in settingEnv.Assemblies)
            {
                // The next Assembly to test is
                string testAssembly = Path.Combine(settingEnv.Path, assembly);
                if (File.Exists(testAssembly))
                {
                    finished.Reset();
                    // Create lists
                    failed = new List <string>();
                    passed = new List <string>();

                    using (var runner = AssemblyRunner.WithAppDomain(testAssembly))
                    {
                        runner.OnExecutionComplete = OnExecutionComplete;
                        runner.OnTestFailed        = OnTestFailed;
                        runner.OnTestPassed        = OnTestPassed;

                        if (settingEnv.Console)
                        {
                            Console.WriteLine("Running...");
                        }
                        runner.Start();

                        finished.WaitOne();
                        // Now generate Result file
                        this.build_Vagrant(testAssembly);
                        if (settingEnv.Details)
                        {
                            this.generateMD(testAssembly);
                        }
                        // ....
                    }
                }
                else
                {
                    TestData_Vagrant vagrant = new TestData_Vagrant();
                    vagrant.TestAssembly = Path.GetFileName(testAssembly);
                    vagrant.Result       = "File Not Found";
                    //
                    testData_Vagrant.Add(vagrant);
                    //
                    if (settingEnv.Console)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Assembly not Found : {0}", testAssembly);
                        Console.ResetColor();
                    }
                }
            }
            this.generateMD_Vagrant();
            finished.Dispose();
        }