Пример #1
0
        /// <inheritdoc/>
        public List <TestCaseDescriptor> GetTestCaseDescriptors(List <ITestCase> testCases, bool includeSerialization)
        {
            var callbackContainer            = new DescriptorCallback();
            Action <List <string> > callback = callbackContainer.Callback;

            if (defaultTestCaseDescriptorProvider == null)
            {
                if (AppDomain.HasAppDomain)
                {
                    try
                    {
                        AppDomain.CreateObject <object>(TestFrameworkAssemblyName, "Xunit.Sdk.TestCaseDescriptorFactory", includeSerialization ? RemoteDiscoverer : null, testCases, callback);
                        if (callbackContainer.Results != null)
                        {
                            return(callbackContainer.Results.Select(x => new TestCaseDescriptor(x)).ToList());
                        }
                    }
                    catch (TypeLoadException) { }    // Only be willing to eat "Xunit.Sdk.TestCaseDescriptorFactory" doesn't exist
                }

                defaultTestCaseDescriptorProvider = new DefaultTestCaseDescriptorProvider(RemoteDiscoverer);
            }

            return(defaultTestCaseDescriptorProvider.GetTestCaseDescriptors(testCases, includeSerialization));
        }
Пример #2
0
        /// <inheritdoc/>
        public List <TestCaseDescriptor> GetTestCaseDescriptors(List <ITestCase> testCases, bool includeSerialization)
        {
            var callbackContainer            = new DescriptorCallback();
            Action <List <string> > callback = callbackContainer.Callback;

            if (defaultTestCaseDescriptorProvider == null)
            {
                if (appDomain.HasAppDomain)
                {
                    try
                    {
                        appDomain.CreateObject <object>(testFrameworkAssemblyName, "Xunit.Sdk.TestCaseDescriptorFactory", includeSerialization ? discoverer : null, testCases, callback);
                        if (callbackContainer.Results != null)
                        {
                            return(callbackContainer.Results.Select(x => new TestCaseDescriptor(x)).ToList());
                        }
                    }
                    catch { }
                }

                defaultTestCaseDescriptorProvider = new DefaultTestCaseDescriptorProvider(discoverer);
            }

            return(defaultTestCaseDescriptorProvider.GetTestCaseDescriptors(testCases, includeSerialization));
        }
Пример #3
0
 void EnsureInitialized()
 {
     if (innerController == null)
     {
         innerController    = CreateInnerController();
         descriptorProvider = (innerController as ITestCaseDescriptorProvider) ?? new DefaultTestCaseDescriptorProvider(innerController);
         bulkDeserializer   = (innerController as ITestCaseBulkDeserializer) ?? new DefaultTestCaseBulkDeserializer(innerController);
         toDispose.Push(innerController);
     }
 }
Пример #4
0
        public VsDiscoverySink(string source,
                               ITestFrameworkDiscoverer discoverer,
                               LoggerHelper logger,
                               ITestCaseDiscoverySink discoverySink,
                               ITestFrameworkDiscoveryOptions discoveryOptions,
                               TestPlatformContext testPlatformContext,
                               Func <bool> cancelThunk)
        {
            this.source              = source;
            this.discoverer          = discoverer;
            this.logger              = logger;
            this.discoverySink       = discoverySink;
            this.discoveryOptions    = discoveryOptions;
            this.testPlatformContext = testPlatformContext;
            this.cancelThunk         = cancelThunk;

            descriptorProvider = (discoverer as ITestCaseDescriptorProvider) ?? new DefaultTestCaseDescriptorProvider(discoverer);

            discoveryEventSink.TestCaseDiscoveryMessageEvent += HandleTestCaseDiscoveryMessage;
            discoveryEventSink.DiscoveryCompleteMessageEvent += HandleDiscoveryCompleteMessage;
        }