Beispiel #1
0
 public void Visit(TestCaseResult result)
 {
     if(result.Executed)
     {
         if(result.IsFailure)
         {
             TestResultItem item = new TestResultItem(result);
             //string resultString = String.Format("{0}:{1}", result.Name, result.Message);
             testDetails.BeginUpdate();
             testDetails.Items.Insert(testDetails.Items.Count, item);
             testDetails.EndUpdate();
         }
     }
     else
     {
         notRunTree.Nodes.Add(MakeNotRunNode(result));
     }
 }
		private void ProcessResults(TestResult result)
		{
			switch( result.ResultState )
			{
                case ResultState.Failure:
                case ResultState.Error:
					TestResultItem item = new TestResultItem(result);
					//string resultString = String.Format("{0}:{1}", result.Name, result.Message);
					testDetails.BeginUpdate();
					testDetails.Items.Insert(testDetails.Items.Count, item);
					testDetails.EndUpdate();
			        break;
                case ResultState.Skipped:
                case ResultState.NotRunnable:
                case ResultState.Ignored:
    				notRunTree.Nodes.Add(MakeNotRunNode(result));
			        break;
			}

			if ( result.HasResults )
				foreach (TestResult childResult in result.Results)
	                ProcessResults( childResult );
        }
		private void InsertTestResultItem( TestResultItem item )
		{
			detailList.BeginUpdate();
			detailList.Items.Insert(detailList.Items.Count, item);
			detailList.SelectedIndex = 0;
			detailList.EndUpdate();
		}
		private void InsertTestResultItem( TestResult result )
		{
			TestResultItem item = new TestResultItem(result);
			InsertTestResultItem( item );
		}
		private void OnTestException(object sender, TestEventArgs args)
		{
			string msg = string.Format( "An unhandled {0} was thrown while executing this test : {1}",
				args.Exception.GetType().FullName, args.Exception.Message );
			TestResultItem item = new TestResultItem( args.Name, msg, args.Exception.StackTrace );
				
			InsertTestResultItem( item );
		}