2010-03-02 Jb Evain <jbevain@novell.com>
[mcs.git] / nunit24 / ConsoleRunner / nunit-console / ConsoleOptions.cs
blob1df69aa69a25c002b4a458e3601a0c89a42dc298
1 // ****************************************************************
2 // This is free software licensed under the NUnit license. You
3 // may obtain a copy of the license as well as information regarding
4 // copyright ownership at http://nunit.org/?p=license&r=2.4.
5 // ****************************************************************
7 namespace NUnit.ConsoleRunner
9 using System;
10 using Codeblast;
11 using NUnit.Util;
13 public class ConsoleOptions : CommandLineOptions
15 public enum DomainUsage
17 Default,
18 None,
19 Single,
20 Multiple
23 [Option(Short="load", Description = "Test fixture to be loaded")]
24 public string fixture;
26 [Option(Description = "Name of the test to run")]
27 public string run;
29 [Option(Description = "Project configuration to load")]
30 public string config;
32 [Option(Description = "Name of XML output file")]
33 public string xml;
35 [Option(Description = "Name of transform file")]
36 public string transform;
38 [Option(Description = "Display XML to the console")]
39 public bool xmlConsole;
41 [Option(Short="out", Description = "File to receive test output")]
42 public string output;
44 [Option(Description = "File to receive test error output")]
45 public string err;
47 [Option(Description = "Label each test in stdOut")]
48 public bool labels = false;
50 [Option(Description = "List of categories to include")]
51 public string include;
53 [Option(Description = "List of categories to exclude")]
54 public string exclude;
56 // [Option(Description = "Run in a separate process")]
57 // public bool process;
59 [Option(Description = "AppDomain Usage for Tests")]
60 public DomainUsage domain;
62 [Option(Description = "Disable shadow copy when running in separate domain")]
63 public bool noshadow;
65 [Option (Description = "Disable use of a separate thread for tests")]
66 public bool nothread;
68 [Option(Description = "Wait for input before closing console window")]
69 public bool wait = false;
71 [Option(Description = "Do not display the logo")]
72 public bool nologo = false;
74 [Option(Description = "Do not display progress" )]
75 public bool nodots = false;
77 [Option(Short="?", Description = "Display help")]
78 public bool help = false;
80 public ConsoleOptions( params string[] args ) : base( args ) {}
82 public ConsoleOptions( bool allowForwardSlash, params string[] args ) : base( allowForwardSlash, args ) {}
84 public bool Validate()
86 if(isInvalid) return false;
88 if(NoArgs) return true;
90 if(ParameterCount >= 1) return true;
92 return false;
95 protected override bool IsValidParameter(string parm)
97 return NUnitProject.CanLoadAsProject( parm ) || PathUtils.IsAssemblyFileType( parm );
101 public bool IsTestProject
105 return ParameterCount == 1 && NUnitProject.CanLoadAsProject((string)Parameters[0]);
109 public override void Help()
111 Console.WriteLine();
112 Console.WriteLine( "NUNIT-CONSOLE [inputfiles] [options]" );
113 Console.WriteLine();
114 Console.WriteLine( "Runs a set of NUnit tests from the console." );
115 Console.WriteLine();
116 Console.WriteLine( "You may specify one or more assemblies or a single" );
117 Console.WriteLine( "project file of type .nunit." );
118 Console.WriteLine();
119 Console.WriteLine( "Options:" );
120 base.Help();
121 Console.WriteLine();
122 Console.WriteLine( "Options that take values may use an equal sign, a colon" );
123 Console.WriteLine( "or a space to separate the option from its value." );
124 Console.WriteLine();