Esempio n. 1
0
 public void SetUp()
 {
     menu    = new MenuItem();
     files   = new FakeRecentFiles();
     handler = new RecentFileMenuHandler(menu, files);
     handler.ShowMissingFiles = true;
 }
		public void SetUp()
		{
			menu = new MenuItem();
			files = new FakeRecentFiles();
			handler = new RecentFileMenuHandler( menu, files );
            handler.ShowMissingFiles = true;
        }
 public void SetUp()
 {
     menu    = new MenuItem();
     files   = new FakeRecentFiles();
     handler = new RecentFileMenuHandler(menu, files);
     handler.CheckFilesExist = false;
 }
		public void SetUp()
		{
			menu = new MenuItem();
			files = new FakeRecentFiles();
			handler = new RecentFileMenuHandler( menu, files );
            handler.CheckFilesExist = false;
        }
        public void SetUp()
        {
            NUnitRegistry.TestMode = true;
            NUnitRegistry.ClearTestKeys();

            menu     = new MenuItem();
            projects = UserSettings.RecentProjects;
            handler  = new RecentFileMenuHandler(menu, projects);
        }
        public void SetUp()
        {
            _model       = new TestModel(new MockTestEngine());
            _settings    = _model.Services.UserSettings.Gui.RecentProjects;
            _recentFiles = _model.Services.RecentFiles;

            _menu    = new MenuItem();
            _handler = new RecentFileMenuHandler(_menu, _model, f => !f.StartsWith("_"));
        }
Esempio n. 7
0
		/// <summary>
		/// Get saved options when form loads
		/// </summary>
		private void NUnitForm_Load(object sender, System.EventArgs e)
		{
			if ( !this.DesignMode )
			{
				// TODO: Can these controls add their menus themselves?
				this.viewMenu.MenuItems.Add(3, resultTabs.TabsMenu);
				this.viewMenu.MenuItems.Add(4, testTree.TreeMenu);

				EnableRunCommand( false );
				EnableStopCommand( false );

				recentProjectsMenuHandler = new RecentFileMenuHandler( recentProjectsMenu, recentFilesService );
                recentProjectsMenuHandler.CheckFilesExist = userSettings.GetSetting("Gui.RecentProjects.CheckFilesExist", true);

				LoadFormSettings();
				SubscribeToTestEvents();
				InitializeControls();

				// Force display  so that any "Loading..." or error 
				// message overlays the main form.
				this.Show();
				this.Invalidate();
				this.Update();

                // Set Capture options for the TestLoader
                TestLoader.IsTracingEnabled = resultTabs.IsTracingEnabled;
                TestLoader.LoggingThreshold = resultTabs.MaximumLogLevel;

				// Load test specified on command line or
				// the most recent one if options call for it
				if ( guiOptions.ParameterCount != 0 )
                    presenter.OpenProject((string)guiOptions.Parameters[0], guiOptions.config, guiOptions.fixture);
				else if( userSettings.GetSetting( "Options.LoadLastProject", true ) && !guiOptions.noload )
				{
					foreach( RecentFileEntry entry in recentFilesService.Entries )
					{
						if ( entry != null && entry.Exists && entry.IsCompatibleCLRVersion )
						{
                            presenter.OpenProject(entry.Path, guiOptions.config, guiOptions.fixture);
							break;
						}
					}
				}

				if ( guiOptions.include != null )
				{
					string[] categories = guiOptions.include.Split( ',' );
					if ( categories.Length > 0 )
						this.testTree.SelectCategories( categories, false );
				}
				else if ( guiOptions.exclude != null )
				{
					string[] categories = guiOptions.exclude.Split( ',' );
					if ( categories.Length > 0 )
						this.testTree.SelectCategories( categories, true );
				}

				// Run loaded test automatically if called for
				if ( TestLoader.IsTestLoaded )
					if ( guiOptions.run || guiOptions.runselected )
					{
						// TODO: Temporary fix to avoid problem when /run is used 
						// with ReloadOnRun turned on. Refactor TestLoader so
						// we can just do a run without reload.
						bool reload = Services.UserSettings.GetSetting("Options.TestLoader.ReloadOnRun", false);
					
						try
						{
							Services.UserSettings.SaveSetting("Options.TestLoader.ReloadOnRun", false);
                            if (guiOptions.runselected)
                                testTree.RunSelectedTests();
                            else
                                testTree.RunAllTests(false);
						}
						finally
						{
							Services.UserSettings.SaveSetting("Options.TestLoader.ReloadOnRun", reload);
						}
					}
			}
		}
Esempio n. 8
0
        /// <summary>
        /// Get saved options when form loads
        /// </summary>
        private void NUnitForm_Load(object sender, System.EventArgs e)
        {
            if ( !this.DesignMode )
            {
                // TODO: Can these controls add their menus themselves?
                this.viewMenu.MenuItems.Add(3, resultTabs.TabsMenu);
                this.viewMenu.MenuItems.Add(4, testTree.TreeMenu);

                EnableRunCommand( false );
                EnableStopCommand( false );

                recentProjectsMenuHandler = new RecentFileMenuHandler( recentProjectsMenu, recentFilesService );

                LoadFormSettings();
                SubscribeToTestEvents();
                InitializeControls();

                // Force display  so that any "Loading..." or error
                // message overlays the main form.
                this.Show();
                this.Invalidate();
                this.Update();

                // Load test specified on command line or
                // the most recent one if options call for it
                if ( commandLineOptions.testFileName != null )
                    TestLoaderUI.OpenProject( this, commandLineOptions.testFileName, commandLineOptions.configName, commandLineOptions.testName );
                else if( userSettings.GetSetting( "Options.LoadLastProject", true ) && !commandLineOptions.noload )
                {
                    foreach( RecentFileEntry entry in recentFilesService.Entries )
                    {
                        if ( entry != null && entry.Exists && entry.IsCompatibleCLRVersion )
                        {
                            TestLoaderUI.OpenProject( this, entry.Path, commandLineOptions.configName, commandLineOptions.testName );
                            break;
                        }
                    }
                }

                if ( commandLineOptions.categories != null )
                {
                    string[] categories = commandLineOptions.categories.Split( ',' );
                    if ( categories.Length > 0 )
                        this.testTree.SelectCategories( commandLineOptions.categories.Split( ',' ), commandLineOptions.exclude );
                }

                // Run loaded test automatically if called for
                if ( commandLineOptions.autorun && TestLoader.IsTestLoaded )
                {
                    // TODO: Temporary fix to avoid problem when /run is used
                    // with ReloadOnRun turned on. Refactor TestLoader so
                    // we can just do a run without reload.
                    bool reload = TestLoader.ReloadOnRun;

                    try
                    {
                        TestLoader.ReloadOnRun = false;
                        TestLoader.RunTests();
                    }
                    finally
                    {
                        TestLoader.ReloadOnRun = reload;
                    }
                }
            }
        }