Ejemplo n.º 1
0
        /// <summary>
        /// Reinvoke testrunner to run an individual test file in its own process
        /// </summary>
        ///
        static bool Reinvoke(string testFile)
        {
            var exitCode =
                ProcessExtensions.ExecuteDotnet(
                    ProgramPath,
                    $"--inproc --outputformat machine \"{testFile}\"",
                    (proc, line) => {
                var e = MachineReadableEventSerializer.TryDeserialize(line);
                EventHandlerPipeline.Raise(
                    e ??
                    new StandardOutputEvent()
                {
                    ProcessId = proc.Id,
                    Message   = line,
                });
            },
                    (proc, line) => {
                EventHandlerPipeline.Raise(
                    new ErrorOutputEvent()
                {
                    ProcessId = proc.Id,
                    Message   = line,
                });
            });

            return(exitCode == 0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reinvoke testrunner to run an individual test file in its own process
        /// </summary>
        ///
        static bool Reinvoke(string testFile)
        {
            var args = new List <string>();

            args.Add("--inproc");
            args.Add("--outputformat machine");

            foreach (var @class in ArgumentParser.Classes)
            {
                args.Add($"--class {@class}");
            }

            foreach (var method in ArgumentParser.Methods)
            {
                args.Add($"--method {method}");
            }

            args.Add($"\"{testFile}\"");

            var exitCode =
                ProcessExtensions.ExecuteDotnet(
                    Assembly.GetExecutingAssembly().Location,
                    string.Join(" ", args),
                    (proc, line) => {
                var e = MachineReadableEventSerializer.TryDeserialize(line);
                EventHandlerPipeline.Raise(
                    e ??
                    new StandardOutputEvent()
                {
                    ProcessId = proc.Id,
                    Message   = line,
                });
            },
                    (proc, line) => {
                EventHandlerPipeline.Raise(
                    new ErrorOutputEvent()
                {
                    ProcessId = proc.Id,
                    Message   = line,
                });
            });

            return(exitCode == 0);
        }