static void Main(string[] args) { try { var setupData = Runner.ParseCommandLineArguments(args); runner = new Runner(setupData); Run(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
internal RunnerViewModel(IContext context) { this.context = context; var setupData = new RunnerSetupData { WorkingDirectory = !String.IsNullOrEmpty(Settings.Default.workingDirectory) && Directory.Exists(Settings.Default.workingDirectory) ? Settings.Default.workingDirectory : Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), TestAssembly = !String.IsNullOrEmpty(Settings.Default.assemblyPath) && File.Exists(Settings.Default.assemblyPath) ? Settings.Default.assemblyPath : null, Results = !String.IsNullOrEmpty(Settings.Default.resultsPath) ? Settings.Default.resultsPath : null, Timeout = Settings.Default.timeout, IsDebug = Settings.Default.isDebug, }; runner = new Runner(setupData); if (Settings.Default.selectedProduct > runner.Products.Count - 1) { SelectedProductIndex = -1; } else { SelectedProductIndex = Settings.Default.selectedProduct; } SetAssemblyPathCommand = new DelegateCommand(SetAssemblyPath, CanSetAssemblyPath); SetResultsPathCommand = new DelegateCommand(SetResultsPath, CanSetResultsPath); SetWorkingPathCommand = new DelegateCommand(SetWorkingPath, CanSetWorkingPath); RunCommand = new DelegateCommand<object>(Run, CanRun); SaveSettingsCommand = new DelegateCommand(SaveSettings, CanSaveSettings); CleanupCommand = new DelegateCommand(runner.Cleanup, CanCleanup); CancelCommand = new DelegateCommand(Cancel, CanCancel); UpdateSummaryCommand = new DelegateCommand(UpdateSummary, CanUpdateSummary); runner.Products.CollectionChanged += Products_CollectionChanged; runner.TestComplete += runner_TestComplete; runner.TestFailed += runner_TestFailed; runner.TestTimedOut += runner_TestTimedOut; watcher = new FileSystemWatcher { Path = Path.GetDirectoryName(AssemblyPath), NotifyFilter = NotifyFilters.LastWrite, Filter = Path.GetFileName(AssemblyPath) }; watcher.Changed += watcher_Changed; watcher.EnableRaisingEvents = true; }