Beispiel #1
0
        private void DoRegisterExtensions(ITestRunner runner, TestProject consolidatedTestProject)
        {
            if (EchoResults)
            {
                runner.RegisterExtension(new LogExtension());
            }

            foreach (ITestRunnerExtension extension in consolidatedTestProject.TestRunnerExtensions)
            {
                runner.RegisterExtension(extension);
            }

            // de-dupe extension specs
            List <string> uniqueExtensionSpecifications = new List <string>();

            GenericCollectionUtils.AddAllIfNotAlreadyPresent(consolidatedTestProject.TestRunnerExtensionSpecifications,
                                                             uniqueExtensionSpecifications);

            foreach (string extensionSpecification in uniqueExtensionSpecifications)
            {
                var testRunnerExtension =
                    TestRunnerExtensionUtils.CreateExtensionFromSpecification(extensionSpecification);
                runner.RegisterExtension(testRunnerExtension);
            }
        }
 public void CreateTestRunnerExtension(string extensionSpecification, Type expectedExtensionType,
                                       string expectedParameters)
 {
     using (new CurrentDirectorySwitcher(RuntimeAccessor.RuntimePath))
     {
         ITestRunnerExtension extension = TestRunnerExtensionUtils.CreateExtensionFromSpecification(extensionSpecification);
         Assert.IsNotNull(extension);
         Assert.IsInstanceOfType(expectedExtensionType, extension);
         Assert.AreEqual(expectedParameters, extension.Parameters);
     }
 }
        private void RegisterTestRunnerExtensions(IEnumerable <string> testRunnerExtensions,
                                                  ITestRunner testRunner)
        {
            var extensionSpecifications = new List <string>();

            GenericCollectionUtils.AddAllIfNotAlreadyPresent(testRunnerExtensions,
                                                             extensionSpecifications);
            GenericCollectionUtils.AddAllIfNotAlreadyPresent(optionsController.TestRunnerExtensions,
                                                             extensionSpecifications);

            foreach (var extensionSpecification in extensionSpecifications)
            {
                var testRunnerExtension = TestRunnerExtensionUtils.CreateExtensionFromSpecification(extensionSpecification);
                testRunner.RegisterExtension(testRunnerExtension);
            }
        }
        private void addExtensionButton_Click(object sender, EventArgs e)
        {
            try
            {
                TestRunnerExtensionUtils.CreateExtensionFromSpecification(newExtensionTextBox.Text);
            }
            catch (RunnerException ex)
            {
                ErrorDialog.Show(this, "Add Extension",
                                 "Could not instantiate an extension from the given specification. The extension has not been added.",
                                 ex.ToString());
                return;
            }

            testRunnerExtensions.Add(newExtensionTextBox.Text);
            PendingSettingsChanges = true;
            testRunnerExtensionsListBox.Items.Add(newExtensionTextBox.Text);
            newExtensionTextBox.Text = string.Empty;
        }
 ///<summary>
 /// Create a <see cref="ITestRunnerExtension" /> from a specification.
 ///</summary>
 ///<param name="specification">A test runner extension specification.</param>
 ///<returns>A <see cref="ITestRunnerExtension" />.</returns>
 public ITestRunnerExtension CreateFromSpecification(string specification)
 {
     return(TestRunnerExtensionUtils.CreateExtensionFromSpecification(specification));
 }