/// <inheritdoc /> public IReportFormatter GetReportFormatter(string formatterName) { if (formatterName == null) { throw new ArgumentNullException("name"); } ComponentHandle <IReportFormatter, ReportFormatterTraits> handle = GenericCollectionUtils.Find(formatterHandles, h => string.Compare(h.GetTraits().Name, formatterName, true) == 0); return(handle != null?handle.GetComponent() : null); }
/// <inheritdoc /> public ITestRunnerFactory GetFactory(string factoryName) { if (factoryName == null) { throw new ArgumentNullException(@"factoryName"); } ComponentHandle <ITestRunnerFactory, TestRunnerFactoryTraits> handle = GenericCollectionUtils.Find(factoryHandles, h => string.Compare(h.GetTraits().Name, factoryName, true) == 0); return(handle != null?handle.GetComponent() : null); }
private static Func<PreferencePane> GetPreferencePaneFactory(ComponentHandle<IPreferencePaneProvider, PreferencePaneProviderTraits> preferencePaneProviderHandle) { return () => preferencePaneProviderHandle.GetComponent().CreatePreferencePane(); }
private static GallioFunc <ControlPanelTab> GetControlPanelTabFactory(ComponentHandle <IControlPanelTabProvider, ControlPanelTabProviderTraits> controlPanelTabProviderHandle) { return(() => controlPanelTabProviderHandle.GetComponent().CreateControlPanelTab()); }
private static Func <PreferencePane> GetPreferencePaneFactory(ComponentHandle <IPreferencePaneProvider, PreferencePaneProviderTraits> preferencePaneProviderHandle) { return(() => preferencePaneProviderHandle.GetComponent().CreatePreferencePane()); }
private static Func<ControlPanelTab> GetControlPanelTabFactory(ComponentHandle<IControlPanelTabProvider, ControlPanelTabProviderTraits> controlPanelTabProviderHandle) { return () => controlPanelTabProviderHandle.GetComponent().CreateControlPanelTab(); }
public void ExecuteCommand() { commandHandle.GetComponent().Execute(this); }
private bool ForEachDriver <T>(MultiMap <TestFrameworkSelection, T> testFrameworkPartitions, Func <ITestDriver, IList <T>, int, bool> func) where T : class { var testDriverPartitions = new Dictionary <TestDriverFactory, TestDriverData <T> >(); foreach (var testFrameworkPartition in testFrameworkPartitions) { if (testFrameworkPartition.Value.Count != 0) { TestFrameworkSelection testFrameworkSelection = testFrameworkPartition.Key; ComponentHandle <ITestFramework, TestFrameworkTraits> testFrameworkHandle = testFrameworkSelection.TestFrameworkHandle; TestDriverFactory testDriverFactory = testFrameworkHandle.GetComponent().GetTestDriverFactory(); TestDriverData <T> testDriverData; if (!testDriverPartitions.TryGetValue(testDriverFactory, out testDriverData)) { testDriverData = new TestDriverData <T>(testFrameworkSelection.TestFrameworkOptions); testDriverPartitions.Add(testDriverFactory, testDriverData); } else { testDriverData.ItemIndex = new HashSet <T>(ReferentialEqualityComparer <T> .Instance); GenericCollectionUtils.AddAll(testDriverData.Items, testDriverData.ItemIndex); } testDriverData.TestFrameworkHandles.Add(testFrameworkHandle); foreach (var item in testFrameworkPartition.Value) { if (testDriverData.ItemIndex == null) { testDriverData.Items.Add(item); } else if (!testDriverData.ItemIndex.Contains(item)) { testDriverData.Items.Add(item); testDriverData.ItemIndex.Add(item); } } } } int testDriverCount = testDriverPartitions.Count; foreach (var testDriverPartition in testDriverPartitions) { TestDriverFactory testDriverFactory = testDriverPartition.Key; TestDriverData <T> testDriverData = testDriverPartition.Value; try { ITestDriver driver = testDriverFactory(testDriverData.TestFrameworkHandles, testDriverData.TestFrameworkOptions, logger); if (func(driver, testDriverData.Items, testDriverCount)) { return(true); } } catch (Exception ex) { //UnhandledExceptionPolicy.Report("An unhandled exception occurred while invoking a test driver.", ex); throw new ModelException("An exception occurred while invoking a test driver.", ex); } } return(false); }