/// <summary>
		/// The current test suite has changed in some way,
		/// so update the info in the UI and clear the
		/// test results, since they are no longer valid.
		/// </summary>
		private void OnTestChanged( object sender, TestEventArgs e )
		{
            SetTitleBar(TestProject.Name);

			if ( longOpDisplay != null )
			{
				longOpDisplay.Dispose();
				longOpDisplay = null;
			}

            if (userSettings.GetSetting("Options.TestLoader.ClearResultsOnReload", false))
                runCount.Text = null;

			EnableRunCommand( true );
		}
		/// <summary>
		/// Event handler for assembly load failures. We do this via
		/// an event since some errors may occur asynchronously.
		/// </summary>
		private void OnTestLoadFailure( object sender, TestEventArgs e )
		{
			if ( longOpDisplay != null )
			{
				longOpDisplay.Dispose();
				longOpDisplay = null;
			}
			
			string message = e.Action == NUnit.Util.TestAction.TestReloadFailed
                ? "Test reload failed!"
                : "Test load failed!";
			if ( e.Exception is BadImageFormatException )
				message += string.Format(
                    Environment.NewLine + Environment.NewLine +
					@"You may be attempting to load an assembly built with a later version of the CLR than
the version under which NUnit is currently running ({0}) or trying to load a 64-bit assembly into a 32-bit process.",
					Environment.Version.ToString(3) );

            MessageDisplay.Error(message, e.Exception);

			if ( !IsTestLoaded )
				OnTestUnloaded( sender, e );
			else
				EnableRunCommand( true );
		}
		private void OnReloadStarting( object sender, TestEventArgs e )
		{
			EnableRunCommand( false );
			longOpDisplay = new LongRunningOperationDisplay( this, "Reloading..." );
		}
		/// <summary>
		/// A test suite has been loaded, so update 
		/// recent assemblies and display the tests in the UI
		/// </summary>
		private void OnTestLoaded( object sender, TestEventArgs e )
		{
			if ( longOpDisplay != null )
			{
				longOpDisplay.Dispose();
				longOpDisplay = null;
			}
			EnableRunCommand( true );
			
			if ( TestLoader.TestCount == 0 )
			{
				foreach( TestAssemblyInfo info in TestLoader.AssemblyInfo )
					if ( info.TestFrameworks.Count > 0 ) return;

                MessageDisplay.Error("This assembly was not built with any known testing framework.");
			}
		}
        /// <summary>
        /// Event handler for assembly load faiulres. We do this via
        /// an event since some errors may occur asynchronously.
        /// </summary>
        private void OnTestLoadFailure( object sender, TestEventArgs e )
        {
            if ( longOpDisplay != null )
            {
                longOpDisplay.Dispose();
                longOpDisplay = null;
            }

            string message = null;
            if ( e.Exception is BadImageFormatException )
                message = string.Format(
                    @"You may be attempting to load an assembly built with a later version of the CLR than
            the version under which NUnit is currently running, {0}.",
                    Environment.Version.ToString(3) );

            UserMessage.DisplayFailure( e.Exception, message, "Assembly Not Loaded" );

            if ( !IsTestLoaded )
                OnTestUnloaded( sender, e );
            else
                EnableRunCommand( true );
        }
        /// <summary>
        /// The current test suite has changed in some way,
        /// so update the info in the UI and clear the
        /// test results, since they are no longer valid.
        /// </summary>
        private void OnTestChanged( object sender, TestEventArgs e )
        {
            SetTitleBar(TestProject.Name);

            if ( longOpDisplay != null )
            {
                longOpDisplay.Dispose();
                longOpDisplay = null;
            }
            EnableRunCommand( true );
        }
Example #7
0
        /// <summary>
        /// Event handler for assembly load failures. We do this via
        /// an event since some errors may occur asynchronously.
        /// </summary>
        private void OnTestLoadFailure( object sender, TestEventArgs e )
        {
            if ( longOpDisplay != null )
            {
                longOpDisplay.Dispose();
                longOpDisplay = null;
            }
            
            string message = e.Action == NUnit.Util.TestAction.TestReloadFailed
                ? "Test reload failed!"
                : "Test load failed!";
            string NL = Environment.NewLine;
            if ( e.Exception is BadImageFormatException )
                message += string.Format(NL + NL +
                    "The assembly could not be loaded by NUnit. PossibleProblems include:" + NL + NL +
                    "1. The assembly may not be a valid .NET assembly." + NL + NL +
                    "2. You may be attempting to load an assembly built with a later version of the CLR than the version under which NUnit is currently running ({0})." + NL + NL +
                    "3. You may be attempting to load a 64-bit assembly into a 32-bit process.",
                    Environment.Version.ToString(3) );

            MessageDisplay.Error(message, e.Exception);

            if ( !IsTestLoaded )
                OnTestUnloaded( sender, e );
            else
                EnableRunCommand( true );
        }
Example #8
0
 /// <summary>
 /// The current test suite has changed in some way,
 /// so update the info in the UI and clear the
 /// test results, since they are no longer valid.
 /// </summary>
 private void OnTestChanged( object sender, TestEventArgs e )
 {
     if ( longOpDisplay != null )
     {
         longOpDisplay.Dispose();
         longOpDisplay = null;
     }
     EnableRunCommand( true );
 }
        /// <summary>
        /// The current test suite has changed in some way,
        /// so update the info in the UI and clear the
        /// test results, since they are no longer valid.
        /// </summary>
        private void OnTestChanged( object sender, TestEventArgs e )
        {
            if (TestProject == null) return;//2013-1-11:NUnit.Gui.ArxNet.Tests.NUnitFormArxNetTests.ShowModalDialog���Լ�

            SetTitleBar(TestProject.Name);

            if ( longOpDisplay != null )
            {
                longOpDisplay.Dispose();
                longOpDisplay = null;
            }

            if (userSettings.GetSetting("Options.TestLoader.ClearResultsOnReload", false))
                runCount.Text = null;

            EnableRunCommand( true );
        }