Пример #1
0
 public TaskObserver(ITestMainThreadFixture testMainThreadFixture, Action onDispose)
 {
     _testMainThreadFixture = testMainThreadFixture;
     _onDispose             = onDispose;
     _afterTaskCompleted    = AfterTaskCompleted;
     _tcs         = new TaskCompletionSource <Exception>();
     _stackTraces = new ConcurrentDictionary <int, string>();
 }
Пример #2
0
        internal TaskObserver UseTaskObserver(ITestMainThreadFixture testMainThreadFixture)
        {
            if (_taskObserver.Value != null)
            {
                throw new InvalidOperationException("AsyncLocal<TaskObserver> reentrancy");
            }

            var context = new TaskObserver(testMainThreadFixture, RemoveTaskObserver);

            _taskObserver.Value = context;
            return(context);
        }
Пример #3
0
 public TestMethodRunner(ITestMethod testMethod, IReflectionTypeInfo @class, IReflectionMethodInfo method, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageBus messageBus, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource, object[] constructorArguments, IReadOnlyDictionary <int, Type> methodFixtureTypes, IReadOnlyDictionary <Type, object> assemblyFixtureMappings, XunitTestEnvironment testEnvironment)
     : base(testMethod, @class, method, testCases, diagnosticMessageSink, messageBus, aggregator, cancellationTokenSource, constructorArguments)
 {
     _assemblyFixtureMappings = assemblyFixtureMappings;
     _testEnvironment         = testEnvironment;
     _diagnosticMessageSink   = diagnosticMessageSink;
     _constructorArguments    = constructorArguments;
     _methodFixtureTypes      = methodFixtureTypes;
     _testMainThreadFixture   = assemblyFixtureMappings.TryGetValue(typeof(ITestMainThreadFixture), out object fixture)
         ? (ITestMainThreadFixture)fixture
         : NullTestMainThreadFixture.Instance;
     _stopwatch = new Stopwatch();
 }