public ObservationDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink) : base(assemblyInfo, sourceProvider, diagnosticMessageSink) { var testAssembly = new TestAssembly(assemblyInfo, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); testCollectionFactory = new CollectionPerClassTestCollectionFactory(testAssembly, diagnosticMessageSink); }
protected override async void RunTestCases(IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { var testAssembly = new TestAssembly(AssemblyInfo, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); //executionOptions.SetValue("xunit.execution.DisableParallelization", true); using (var assemblyRunner = new ObservationAssemblyRunner(testAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync(); }
readonly Dictionary<Type, Type> discovererTypeCache = new Dictionary<Type, Type>(); // key is a Type that is or derives from FactAttribute /// <summary> /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class. /// </summary> /// <param name="assemblyInfo">The test assembly.</param> /// <param name="sourceProvider">The source information provider.</param> /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param> /// <param name="collectionFactory">The test collection factory used to look up test collections.</param> public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null) : base(assemblyInfo, sourceProvider, diagnosticMessageSink) { var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault(); var disableParallelization = collectionBehaviorAttribute != null && collectionBehaviorAttribute.GetNamedArgument<bool>("DisableTestParallelization"); string config = null; #if !PLATFORM_DOTNET config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; #endif var testAssembly = new TestAssembly(assemblyInfo, config); TestCollectionFactory = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, testAssembly); TestFrameworkDisplayName = $"{DisplayName} [{TestCollectionFactory.DisplayName}, {(disableParallelization ? "non-parallel" : "parallel")}]"; }
/// <summary> /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class. /// </summary> /// <param name="assemblyInfo">The test assembly.</param> /// <param name="sourceProvider">The source information provider.</param> /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param> /// <param name="collectionFactory">The test collection factory used to look up test collections.</param> public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null) : base(assemblyInfo, sourceProvider, diagnosticMessageSink) { var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault(); var disableParallelization = collectionBehaviorAttribute != null && collectionBehaviorAttribute.GetNamedArgument <bool>("DisableTestParallelization"); string config = null; #if NETFRAMEWORK config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; #endif var testAssembly = new TestAssembly(assemblyInfo, config); TestCollectionFactory = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, testAssembly); TestFrameworkDisplayName = $"{DisplayName} [{TestCollectionFactory.DisplayName}, {(disableParallelization ? "non-parallel" : "parallel")}]"; }
/// <summary> /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class. /// </summary> /// <param name="assemblyInfo">The test assembly.</param> /// <param name="sourceProvider">The source information provider.</param> /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param> /// <param name="collectionFactory">The test collection factory used to look up test collections.</param> public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null) : base(assemblyInfo, sourceProvider, diagnosticMessageSink) { var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault(); var disableParallelization = collectionBehaviorAttribute == null ? false : collectionBehaviorAttribute.GetNamedArgument<bool>("DisableTestParallelization"); string config = null; #if !WINDOWS_PHONE_APP && !WINDOWS_PHONE && !DNXCORE50 config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; #endif var testAssembly = new TestAssembly(assemblyInfo, config); TestCollectionFactory = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, testAssembly); TestFrameworkDisplayName = string.Format("{0} [{1}, {2}]", DisplayName, TestCollectionFactory.DisplayName, disableParallelization ? "non-parallel" : "parallel"); }
/// <summary> /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class. /// </summary> /// <param name="assemblyInfo">The test assembly.</param> /// <param name="sourceProvider">The source information provider.</param> /// <param name="collectionFactory">The test collection factory used to look up test collections.</param> /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param> public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IXunitTestCollectionFactory collectionFactory, IMessageAggregator messageAggregator) : base(assemblyInfo, sourceProvider, messageAggregator) { var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault(); var disableParallelization = collectionBehaviorAttribute == null ? false : collectionBehaviorAttribute.GetNamedArgument <bool>("DisableTestParallelization"); string config = null; #if !WINDOWS_PHONE_APP && !WINDOWS_PHONE && !ASPNETCORE50 config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; #endif var testAssembly = new TestAssembly(assemblyInfo, config); TestCollectionFactory = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(collectionBehaviorAttribute, testAssembly); TestFrameworkDisplayName = String.Format("{0} [{1}, {2}]", DisplayName, TestCollectionFactory.DisplayName, disableParallelization ? "non-parallel" : "parallel"); }