Example #1
0
        private void RunTest()
        {
            _context.CurrentTest   = this.Test;
            _context.CurrentResult = this.Result;
            _context.Listener.TestStarted(this.Test);
            _context.StartTime = DateTime.Now;

            TestExecutionContext.SetCurrentContext(_context);

#if (CLR_2_0 || CLR_4_0) && !SILVERLIGHT && !NETCF_2_0
            long startTicks = Stopwatch.GetTimestamp();
#endif

            try
            {
                PerformWork();
            }
            finally
            {
#if (CLR_2_0 || CLR_4_0) && !SILVERLIGHT && !NETCF_2_0
                long   tickCount = Stopwatch.GetTimestamp() - startTicks;
                double seconds   = (double)tickCount / Stopwatch.Frequency;
                Result.Duration = TimeSpan.FromSeconds(seconds);
#else
                Result.Duration = DateTime.Now - Context.StartTime;
#endif

                Result.AssertCount = _context.AssertCount;

                _context.Listener.TestFinished(Result);

                _context              = _context.Restore();
                _context.AssertCount += Result.AssertCount;
            }
        }
Example #2
0
        private void RunTest()
        {
            Context.CurrentTest   = this.Test;
            Context.CurrentResult = this.Result;
            Context.Listener.TestStarted(this.Test);
            Context.StartTime = DateTime.Now;

            TestExecutionContext.SetCurrentContext(Context);

            long startTicks = Stopwatch.GetTimestamp();

            try
            {
                PerformWork();
            }
            finally
            {
                long   tickCount = Stopwatch.GetTimestamp() - startTicks;
                double seconds   = (double)tickCount / Stopwatch.Frequency;
                Result.Duration = TimeSpan.FromSeconds(seconds);

                Result.AssertCount = Context.AssertCount;

                Context.Listener.TestFinished(Result);

                Context              = Context.Restore();
                Context.AssertCount += Result.AssertCount;
            }
        }
 public void Invoke()
 {
     TestExecutionContext.SetCurrentContext(Context);
     try {
         Result = Func();
     } catch (Exception e) {
         ex = e;
     } finally {
         Waiter.Set();
     }
 }
Example #4
0
        private void RunTest()
        {
            _context.CurrentTest   = this.Test;
            _context.CurrentResult = this.Result;
            _context.Listener.TestStarted(this.Test);
            _context.StartTime = DateTime.Now;

            TestExecutionContext.SetCurrentContext(_context);

#if (CLR_2_0 || CLR_4_0) && !SILVERLIGHT && !NETCF_2_0
            long startTicks = Stopwatch.GetTimestamp();
#endif

            finD.Set(_context, startTicks, Result);
            PerformWork();
        }
Example #5
0
        private void RunTest()
        {
            _context.CurrentTest   = this.Test;
            _context.CurrentResult = this.Result;
            _context.Listener.TestStarted(this.Test);
            _context.StartTime = DateTime.Now;

            TestExecutionContext.SetCurrentContext(_context);

            try
            {
                PerformWork();
            }
            finally
            {
                Result.AssertCount = _context.AssertCount;
                Result.Time        = (DateTime.Now - _context.StartTime).TotalSeconds;

                _context.Listener.TestFinished(Result);

                _context              = _context.Restore();
                _context.AssertCount += Result.AssertCount;
            }
        }
 private void PerformOneTimeTearDown()
 {
     TestExecutionContext.SetCurrentContext(Context);
     _teardownCommand.Execute(Context);
 }