Ejemplo n.º 1
0
	    private object RunVoidAsyncMethod(TestResult testResult)
        {
            var previousContext = SynchronizationContext.Current;
            var currentContext = new AsyncSynchronizationContext();
            SynchronizationContext.SetSynchronizationContext(currentContext);

            try
            {
                object result = base.RunTestMethod(testResult);

	            try
	            {
		            currentContext.WaitForPendingOperationsToComplete();
	            }
	            catch (Exception e)
	            {
					throw new NUnitException("Rethrown", e);		            
	            }

                return result;
            }
            finally
            {
                SynchronizationContext.SetSynchronizationContext(previousContext);
            }
        }
Ejemplo n.º 2
0
			public AsyncVoidInvocationRegion()
			{
				_previousContext = SynchronizationContext.Current;
				_currentContext = new AsyncSynchronizationContext();
				SynchronizationContext.SetSynchronizationContext(_currentContext);
			}