GuiOptions encapsulates the option settingsServiceServiceService for the nunit-console program. It inherits from the Mono Options OptionSet class and provides a central location for defining and parsing options.
Наследование: OptionSet
Пример #1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CommandLineOptions options = new CommandLineOptions();
            try
            {
                options.Parse(args);
            }
            catch (OptionException ex)
            {
                string msg = string.Format("{0} {1}", ex.Message, ex.OptionName);
                MessageBox.Show(msg, "NUnit - OptionException", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (options.ShowHelp)
            {
                ShowHelpText(options);
                return;
            }

            var testEngine = TestEngineActivator.CreateInstance(true);
            if (options.InternalTraceLevel != null)
                testEngine.InternalTraceLevel = (InternalTraceLevel)Enum.Parse(typeof(InternalTraceLevel), options.InternalTraceLevel);

            var model = new TestModel(testEngine, options);

            var form = new MainForm();
            new MainPresenter(form, model);
            new ProgressBarPresenter(form.ProgressBarView, model);
            new TreeViewPresenter(form.TestTreeView, model);
            new StatusBarPresenter(form.StatusBarView, model);
            new TestPropertiesPresenter(form.PropertiesView, model);
            new XmlPresenter(form.XmlView, model);

            //new RecentFiles(settingsServiceServiceService._settings);
            //new RecentFilesPresenter(form, settingsServiceServiceService);

            try
            {
                Application.Run(form);
            }
            finally
            {
                testEngine.Dispose();
            }
        }
Пример #2
0
        public NUnitForm( CommandLineOptions commandLineOptions )
        {
            InitializeComponent();

            this.commandLineOptions = commandLineOptions;
            this.recentFilesService = Services.RecentFiles;
            this.userSettings = Services.UserSettings;
        }
Пример #3
0
        private static void ShowHelpText(CommandLineOptions options)
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("NUNIT [inputfiles] [options]");
            writer.WriteLine();
            writer.WriteLine("Loads and optionally runs a set of NUnit tests using the GUI runner.");
            writer.WriteLine();
            writer.WriteLine("InputFiles:");
            writer.WriteLine("   One or more assemblies or test projects of a recognized type.");
            writer.WriteLine();
            writer.WriteLine("Options:");
            options.WriteOptionDescriptions(writer);
            writer.WriteLine();
            writer.WriteLine("Description:");
            writer.WriteLine("   By default, this command loads the tests contained in the input");
            writer.WriteLine("   specified, displaying them in the GUI runner, where the user may");
            writer.WriteLine("   run some or all of them as desired. If no input files are given");
            writer.WriteLine("   the tests contained in the most recently used project or assembly");
            writer.WriteLine("   are loaded, unless the --noload option is specified.");
            writer.WriteLine();
            writer.WriteLine("   CATEGORIES may be specified singly, as a comma-separated list or");
            writer.WriteLine("   as a category expression.");
            writer.WriteLine();
            writer.WriteLine("   Trace LEVEL may be Off, Error, Warning, Info, Verbose or Debug.");

            MessageBox.Show(writer.GetStringBuilder().ToString(), "NUnit - Help");
        }