public TestResultEntry(string className, string methodName,bool success,UUnitAssertException exception, double duration, string errormsg){
		this.className = className;
		this.methodName = methodName;
		this.success = success;
		this.exception = exception;
		this.duration = duration;
		this.errormsg = errormsg;
	}
Example #2
0
    public UUnitTestResult RunAll()
    {
        UUnitTestResult res = new UUnitTestResult();

        foreach (Type t in testCases)
        {
            string typeName = t.Name;
            foreach (MethodInfo m in t.GetMethods())
            {
                if (m.Name.StartsWith("Test") && m.GetParameters().Length == 0)
                {
                    ConstructorInfo[] p = t.GetConstructors();

                    for (int i = 0; i < p.Length; i++)
                    {
                        if (p[i].GetParameters().Length == 0)
                        {
                            DateTime startTime1 = DateTime.Now;
                            DateTime stopTime1  = DateTime.Now;

                            UUnitAssertException ae = null;
                            string errMsg           = null;
                            bool   success          = true;
                            try {
                                UUnitTestCase unitTest = (UUnitTestCase)p[i].Invoke(new object[0]);
                                unitTest.Setup();
                                startTime1 = DateTime.Now;
                                m.Invoke(unitTest, new object[0]);
                                stopTime1 = DateTime.Now;
                                unitTest.TearDown();
                            } catch (System.Reflection.TargetInvocationException e) {
                                stopTime1 = DateTime.Now;
                                ae        = e.InnerException as UUnitAssertException;
                                success   = false;
                                if (ae == null)
                                {
                                    errMsg = e.InnerException.ToString();
                                }
                                else
                                {
                                    errMsg = ae.Message;
                                }
                            } catch (System.Exception ex) {
                                stopTime1 = DateTime.Now;
                                success   = false;
                                errMsg    = ex.ToString();
                            }
                            TimeSpan duration1       = stopTime1 - startTime1;
                            double   timeSpendMillis = duration1.TotalMilliseconds;

                            res.AddTestResult(typeName, m.Name, success, ae, timeSpendMillis, errMsg);
                        }
                    }
                }
            }
        }
        return(res);
    }
Example #3
0
 public TestResultEntry(string className, string methodName, bool success, UUnitAssertException exception, double duration, string errormsg)
 {
     this.className  = className;
     this.methodName = methodName;
     this.success    = success;
     this.exception  = exception;
     this.duration   = duration;
     this.errormsg   = errormsg;
 }
	public void AddTestResult(string className,string methodName,bool success,UUnitAssertException exception,double duration, string errormsg){
		resultList.Add(new TestResultEntry(className, methodName, success, exception, duration,errormsg));
		if (success){
			runCount ++;
		} else {
			failedCount ++;
		}
		this.duration += duration;
	}
Example #5
0
 public void AddTestResult(string className, string methodName, bool success, UUnitAssertException exception, double duration, string errormsg)
 {
     resultList.Add(new TestResultEntry(className, methodName, success, exception, duration, errormsg));
     if (success)
     {
         runCount++;
     }
     else
     {
         failedCount++;
     }
     this.duration += duration;
 }