コード例 #1
0
ファイル: Test.cs プロジェクト: bigbearstudios/sharp-test
 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;
     }
 }
コード例 #2
0
ファイル: Test.cs プロジェクト: bigbearstudios/sharp-test
        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);
            }
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: bigbearstudios/sharp-test
 internal override void SetSkipped()
 {
     Format = TestFormat.Skip;
     Result = new TestResult(TestStatus.Skipped);
 }