Exemplo n.º 1
0
        public void WriteResultFile(OutputSpecification spec, DateTime startTime)
        {
            string        outputPath   = Path.Combine(workDirectory, spec.OutputPath);
            IResultWriter outputWriter = null;

            switch (spec.Format)
            {
            case "nunit3":
                outputWriter = new NUnit3XmlOutputWriter();
                break;

            case "nunit2":
                outputWriter = new NUnit2XmlOutputWriter();
                break;

            case "user":
                Uri    uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
                string dir = Path.GetDirectoryName(uri.LocalPath);
                outputWriter = new XmlTransformOutputWriter(Path.Combine(dir, spec.Transform));
                break;

            default:
                throw new ArgumentException(
                          string.Format("Invalid XML output format '{0}'", spec.Format),
                          "spec");
            }

            outputWriter.WriteResultFile(result, outputPath);
            Console.WriteLine("Results ({0}) saved as {1}", spec.Format, outputPath);
        }
Exemplo n.º 2
0
        public void WriteResultFile(OutputSpecification spec, DateTime startTime)
        {
            string outputPath = Path.Combine(workDirectory, spec.OutputPath);
            IResultWriter outputWriter = null;

            switch (spec.Format)
            {
                case "nunit3":
                    outputWriter = new NUnit3XmlOutputWriter();
                    break;

                case "nunit2":
                    outputWriter = new NUnit2XmlOutputWriter();
                    break;

                case "user":
                    Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
                    string dir = Path.GetDirectoryName(uri.LocalPath);
                    outputWriter = new XmlTransformOutputWriter(Path.Combine(dir, spec.Transform));
                    break;

                default:
                    throw new ArgumentException(
                        string.Format("Invalid XML output format '{0}'", spec.Format),
                        "spec");
            }

            outputWriter.WriteResultFile(result, outputPath);
            Console.WriteLine("Results ({0}) saved as {1}", spec.Format, outputPath);
        }