static int Main(string[] args) { NUnitForm.CommandLineOptions command = new NUnitForm.CommandLineOptions(); GuiOptions parser = new GuiOptions(args); if (parser.Validate() && !parser.help) { if (!parser.NoArgs) { if (parser.IsAssembly) { command.testFileName = parser.Assembly; } command.configName = parser.config; command.testName = parser.fixture; command.noload = parser.noload; command.autorun = parser.run; } if (command.testFileName != null) { FileInfo fileInfo = new FileInfo(command.testFileName); if (!fileInfo.Exists) { string message = String.Format("{0} does not exist", fileInfo.FullName); UserMessage.DisplayFailure(message, "Specified test file does not exist"); return(1); } else { command.testFileName = fileInfo.FullName; } } NUnitForm form = new NUnitForm(command); Application.Run(form); } else { string message = parser.GetHelpText(); UserMessage.DisplayFailure(message, "Help Syntax"); return(2); } return(0); }
public static int Main(string[] args) { NUnitForm.CommandLineOptions command = new NUnitForm.CommandLineOptions(); GuiOptions parser = new GuiOptions(args); if (parser.Validate() && !parser.help) { if (parser.cleanup) { DomainManager.DeleteShadowCopyPath(); return(0); } if (!parser.NoArgs) { if (parser.IsAssembly) { command.testFileName = parser.Assembly; } command.configName = parser.config; command.testName = parser.fixture; command.noload = parser.noload; command.autorun = parser.run; if (parser.lang != null) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(parser.lang); } if (parser.HasInclude) { command.categories = parser.include; command.exclude = false; } else if (parser.HasExclude) { command.categories = parser.exclude; command.exclude = true; } } // Add Standard Services to ServiceManager ServiceManager.Services.AddService(new SettingsService()); ServiceManager.Services.AddService(new DomainManager()); ServiceManager.Services.AddService(new RecentFilesService()); ServiceManager.Services.AddService(new TestLoader(new GuiTestEventDispatcher())); ServiceManager.Services.AddService(new AddinRegistry()); ServiceManager.Services.AddService(new AddinManager()); // Initialize Services ServiceManager.Services.InitializeServices(); // Create container in order to allow ambient properties // to be shared across all top-level forms. AppContainer c = new AppContainer(); AmbientProperties ambient = new AmbientProperties(); c.Services.AddService(typeof(AmbientProperties), ambient); NUnitForm form = new NUnitForm(command); c.Add(form); try { Application.Run(form); } finally { ServiceManager.Services.StopAllServices(); } } else { string message = parser.GetHelpText(); UserMessage.DisplayFailure(message, "Help Syntax"); return(2); } return(0); }