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; } }
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); } }
internal override void SetSkipped() { Format = TestFormat.Skip; Result = new TestResult(TestStatus.Skipped); }