Example #1
0
 private void RunMethod()
 {
     try
     {
         if(isAsync)
         {
             try
             {
                 Task task = (Task)Method.Invoke(Caller, new object[]{ });
                 if(task != null)
                 {
                     task.Wait();
                 }
             }
             catch(InvalidCastException ex)
             {
                 Result = new TestResult(ex);
             }
         }
         else
         {
             Method.Invoke(Caller, new object[]{ });
         }
     }
     catch(TargetInvocationException ex)
     {
         throw ex.InnerException;
     }
 }
Example #2
0
        internal override void Run(Reporter reporter)
        {
            if(Format != TestFormat.Skip)
            {
                try
                {
                    long beforeMemory = GC.GetTotalMemory(true);
                    StopWatch.Restart();

                    RunMethod();

                    long elapsedTime = StopWatch.ElapsedMilliseconds;
                    long totalMemory = beforeMemory - GC.GetTotalMemory(true);
                    StopWatch.Stop();

                    Result = new TestResult(TestStatus.Passed, elapsedTime, totalMemory);
                    reporter.CallBuildTestSuccess(this);
                }
                catch(Exception ex)
                {
                    Result = new TestResult(ex);
                    reporter.CallBuildTestFailure(this);
                }
            }
            else
            {
                Result = new TestResult(TestStatus.Skipped);
                reporter.CallBuildTestSkipped(this);
            }
        }
Example #3
0
 internal override void SetSkipped()
 {
     Format = TestFormat.Skip;
     Result = new TestResult(TestStatus.Skipped);
 }