Exemplo n.º 1
0
        private static int Run(Arguments args)
        {
            TestAssemblyScanner       scanner   = new TestAssemblyScanner();
            NUnitTestProjectProcessor processor = new NUnitTestProjectProcessor(scanner);

            string assembliesPath = args.AssembliesPath.FullName;

            Console.WriteLine("Loading assemblies from '{0}'", assembliesPath);

            var sw = new DebugStopwatch("1.Load NunitProject");

            string inputProjectPath = File.Exists(args.InputNUnitProject)
                                ? args.InputNUnitProject
                                : Path.Combine(assembliesPath, args.InputNUnitProject);

            if (!File.Exists(inputProjectPath))
            {
                Console.Error.WriteLine($"File Not Found: {args.InputNUnitProject}");
                return(-102);
            }

            NUnitTestProject inputProject = NUnitTestProject.LoadFromFile(inputProjectPath);

            sw.Dispose();

            int processedAssemblies = processor.Process(
                inputProject,
                args.SplitRules,
                assembliesPath,
                Path.GetDirectoryName(inputProjectPath)
                );

            Console.WriteLine("NUnitTestProjectSplitter finished. Processed {0} assemblies", processedAssemblies);
            return(0);
        }
        public static NUnitTestProject LoadFromFile(string filePath)
        {
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(filePath);
            }

            var proj = new NUnitTestProject();

            proj.Load(filePath);
            return(proj);
        }