public override bool CanReuse(TestRunner runner, TestPackage package) { RuntimeFramework currentFramework = RuntimeFramework.CurrentFramework; RuntimeFramework targetFramework = selector.SelectRuntimeFramework(package); ProcessModel processModel = (ProcessModel)package.GetSetting("ProcessModel", ProcessModel.Default); if (processModel == ProcessModel.Default) { if (!targetFramework.Matches(currentFramework)) { processModel = ProcessModel.Separate; } } switch (processModel) { case ProcessModel.Multiple: return(runner is MultipleTestProcessRunner); case ProcessModel.Separate: ProcessRunner processRunner = runner as ProcessRunner; return(processRunner != null && processRunner.RuntimeFramework == targetFramework); default: return(base.CanReuse(runner, package)); } }
/// <summary> /// Returns a test runner based on the settings in a TestPackage. /// Any setting that is "consumed" by the factory is removed, so /// that downstream runners using the factory will not repeatedly /// create the same type of runner. /// </summary> /// <param name="package">The TestPackage to be loaded and run</param> /// <returns>A TestRunner</returns> public override TestRunner MakeTestRunner(TestPackage package) { RuntimeFramework currentFramework = RuntimeFramework.CurrentFramework; RuntimeFramework targetFramework = selector.SelectRuntimeFramework(package); ProcessModel processModel = (ProcessModel)package.GetSetting("ProcessModel", ProcessModel.Default); if (processModel == ProcessModel.Default) { if (!targetFramework.Matches(currentFramework)) { processModel = ProcessModel.Separate; } } switch (processModel) { case ProcessModel.Multiple: package.Settings.Remove("ProcessModel"); return(new MultipleTestProcessRunner()); case ProcessModel.Separate: package.Settings.Remove("ProcessModel"); return(new ProcessRunner()); default: return(base.MakeTestRunner(package)); } }
private ProcessModel GetTargetProcessModel(TestPackage package) { RuntimeFramework currentFramework = RuntimeFramework.CurrentFramework; RuntimeFramework targetFramework = selector.SelectRuntimeFramework(package); ProcessModel processModel = (ProcessModel)package.GetSetting("ProcessModel", ProcessModel.Default); if (processModel == ProcessModel.Default) { if (!targetFramework.Matches(currentFramework)) { processModel = ProcessModel.Separate; } } return(processModel); }
public bool CanMatchRuntimes(RuntimeFramework f1, RuntimeFramework f2) { return f1.Matches(f2); }
public bool CanMatchRuntimes(RuntimeFramework f1, RuntimeFramework f2) { return(f1.Matches(f2)); }