protected override object?CreateTestClass() { IHandlerTestClass?testClass = null; if (!MessageBus.QueueMessage(new TestClassConstructionStarting(Test))) { CancellationTokenSource.Cancel(); } else { try { if (!CancellationTokenSource.IsCancellationRequested) { Timer.Aggregate(() => { testClass = (IHandlerTestClass)Activator.CreateInstance(TestClass, ConstructorArguments); testClass.SetDefinition(TestDefinitionProvider.GetDefinitions().First((x) => x.Name == ((HandlerTest)Test).HandlerName)); }); } } finally { if (!MessageBus.QueueMessage(new TestClassConstructionFinished(Test))) { CancellationTokenSource.Cancel(); } } } return(testClass); }
public IEnumerable <IXunitTestCase> Discover( ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute ) { foreach (HandlerTestDefinition definition in TestDefinitionProvider.GetDefinitions()) { yield return(new HandlerTestCase( _diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod, definition.Name )); } }