示例#1
0
        public void InitializeShouldLoadAndInitializeAllExtension()
        {
            var commonAssemblyLocation = typeof(TestPluginCacheTests).GetTypeInfo().Assembly.Location;

            TestPluginCacheTests.SetupMockExtensions(
                new string[] { commonAssemblyLocation },
                () => { });


            this.executionManager.Initialize(new List <string> {
                commonAssemblyLocation
            });

            Assert.IsNotNull(TestPluginCache.Instance.TestExtensions);

            // Executors
            Assert.IsTrue(TestPluginCache.Instance.TestExtensions.TestExecutors.Count > 0);
            var allExecutors = TestExecutorExtensionManager.Create().TestExtensions;

            foreach (var executor in allExecutors)
            {
                Assert.IsTrue(executor.IsExtensionCreated);
            }

            // Settings Providers
            Assert.IsTrue(TestPluginCache.Instance.TestExtensions.TestSettingsProviders.Count > 0);
            var settingsProviders = SettingsProviderExtensionManager.Create().SettingsProvidersMap.Values;

            foreach (var provider in settingsProviders)
            {
                Assert.IsTrue(provider.IsExtensionCreated);
            }
        }
示例#2
0
        public void CreateShouldDiscoverExecutorExtensions()
        {
            TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests));

            var extensionManager = TestExecutorExtensionManager.Create();

            Assert.IsNotNull(extensionManager.TestExtensions);
            Assert.IsTrue(extensionManager.TestExtensions.Count() > 0);
        }
示例#3
0
        public void CreateShouldCacheDiscoveredExtensions()
        {
            TestPluginCacheTests.SetupMockExtensions(() => { });

            var extensionManager = TestExecutorExtensionManager.Create();

            TestExecutorExtensionManager.Create();

            Assert.IsNotNull(extensionManager.TestExtensions);
            Assert.IsTrue(extensionManager.TestExtensions.Count() > 0);
        }
示例#4
0
        public void CreateShouldCacheDiscoveredExtensions()
        {
            TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests), () => { });

            var extensionManager = TestExecutorExtensionManager.Create();

            TestExecutorExtensionManager.Create();

            Assert.IsNotNull(extensionManager.TestExtensions);
            Assert.IsTrue(extensionManager.TestExtensions.Any());
        }
示例#5
0
        public void LoadAndInitializeShouldInitializeAllExtensions()
        {
            TestPluginCacheHelper.SetupMockExtensions(typeof(TestExecutorExtensionManagerTests));

            TestExecutorExtensionManager.LoadAndInitializeAllExtensions(false);

            var allExecutors = TestExecutorExtensionManager.Create().TestExtensions;

            foreach (var executor in allExecutors)
            {
                Assert.IsTrue(executor.IsExtensionCreated);
            }
        }
示例#6
0
        public ArgumentProcessorResult Execute()
        {
            ConsoleOutput.Instance.WriteLine(CommandLineResources.AvailableExecutorsHeaderMessage, OutputLevel.Information);
            var testPlatform     = TestPlatformFactory.GetTestPlatform();
            var extensionManager = TestExecutorExtensionManager.Create();

            foreach (var extension in extensionManager.TestExtensions)
            {
                ConsoleOutput.Instance.WriteLine(extension.Value.GetType().FullName, OutputLevel.Information);
                ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.AvailableExtensionsMetadataFormat, "Uri", extension.Metadata.ExtensionUri), OutputLevel.Information);
            }

            return(ArgumentProcessorResult.Success);
        }
示例#7
0
        private TestExecutorExtensionManager GetExecutorExtensionManager(string extensionAssembly)
        {
            try
            {
                if (string.IsNullOrEmpty(extensionAssembly) ||
                    string.Equals(extensionAssembly, Constants.UnspecifiedAdapterPath))
                {
                    // full execution. Since the extension manager is cached this can be created multiple times without harming performance.
                    return(TestExecutorExtensionManager.Create());
                }
                else
                {
                    return(TestExecutorExtensionManager.GetExecutionExtensionManager(extensionAssembly));
                }
            }
            catch (Exception ex)
            {
                EqtTrace.Error(
                    "BaseRunTests: GetExecutorExtensionManager: Exception occurred while loading extensions {0}",
                    ex);

                return(null);
            }
        }