Esempio n. 1
0
        static void Main(string[] args)
        {
            ILicenseChecker licenseChecker = new LicenseChecker();

            if (!licenseChecker.DoesThisMachineHaveAValidLicense())
            {
                Environment.Exit(0);
                return;
            }

            string strFile = args[0];
            string strXmlFileThatWillContainTestCasesOrTestAssemblies;

            if (Path.GetExtension(strFile).ToLower() == ".xml")
            {
                strXmlFileThatWillContainTestCasesOrTestAssemblies = args[0];
                strFile = Path.GetDirectoryName(strFile);
            }
            else
            {
                strXmlFileThatWillContainTestCasesOrTestAssemblies = args[1];
                if (args.Length > 2)
                {
                    _bAllowParameterizationOfTestObjects = Convert.ToBoolean(args[2]);
                }
            }

            //string strFile =
            //    @"C:\Users\aseem\Downloads\OnePlanner\3\NewOneP\Release\OnePlanner.CoreEngine.Tests.dll";
            //string strXmlFileThatWillContainTestCasesOrTestAssemblies =
            //    @"C:\Users\aseem\Downloads\OnePlanner\3\NewOneP\Release\OnePlanner.CoreEngine.TestsTC.xml";

            //string strFile =
            //    @"C:\Users\aseem\Desktop\ParallelTestExecution\NUnitTestProject_3\NUnitTestProject\bin\Debug\NUnitTestProject.dll";
            //string strXmlFileThatWillContainTestCasesOrTestAssemblies =
            //    @"C:\Users\aseem\Desktop\ParallelTestExecution\NUnitTestProject_3\NUnitTestProject\bin\Debug\NUnitTestProjectTC.xml";

            //string strFile = @"C:\Users\aseem\Desktop\ParallelTestExecution\NUnitTestProject_3\NUnitTestProject\bin\Debug\";
            //string strXmlFileThatWillContainTestCasesOrTestAssemblies = @"C:\Users\aseem\Desktop\ParallelTestExecution\NUnitTestProject_3\NUnitTestProject\bin\Debug\NUnitTestProjectTC.xml";

            try
            {
                if (!File.Exists(strFile))
                {
                    if (!Directory.Exists(strFile))
                    {
                        Environment.Exit(0);
                        return;
                    }
                    CreateXmlDocHavingTestingAssembliesRelativePaths(strFile, strXmlFileThatWillContainTestCasesOrTestAssemblies);
                    RunDotNetX(args[0], "");
                    Environment.Exit(0);
                    return;
                }

                if (File.Exists(strXmlFileThatWillContainTestCasesOrTestAssemblies))
                {
                    File.Delete(strXmlFileThatWillContainTestCasesOrTestAssemblies);
                }

                var assembly = Assembly.LoadFrom(strFile);
                CreateXmlDocHavingTestCases(assembly, strXmlFileThatWillContainTestCasesOrTestAssemblies);
                if (!File.Exists(strXmlFileThatWillContainTestCasesOrTestAssemblies))
                {
                    try
                    {
                        RunDotNetX(strFile, strXmlFileThatWillContainTestCasesOrTestAssemblies);
                    }
                    catch (Exception)
                    { }
                }
                Environment.Exit(0);
                return;
            }
            catch
            { }

            if (!File.Exists(strXmlFileThatWillContainTestCasesOrTestAssemblies))
            {
                try
                {
                    RunDotNetX(strFile, strXmlFileThatWillContainTestCasesOrTestAssemblies);
                }
                catch (Exception)
                { }
            }

            //if (!File.Exists(strXmlFileThatWillContainTestCases))
            //{
            //	var assembly = Assembly.UnsafeLoadFrom(strFile);
            //	CreateXmlDocHavingTestCases(assembly, strXmlFileThatWillContainTestCases);
            //}
            Environment.Exit(0);
        }