public static string GetNextSupportingInfoFileName(FeatureContext featureContext, ScenarioContext scenarioContext, string prefix, string extension) { Assert.NotNull(featureContext); Assert.NotNull(scenarioContext); lock (featureContext) lock (scenarioContext) { object objectPictureIndex; if (!scenarioContext.TryGetValue(EmuPictureIndexKey, out objectPictureIndex)) objectPictureIndex = 0; var pictureIndex = (int) objectPictureIndex; scenarioContext[EmuPictureIndexKey] = ++pictureIndex; var fileName = String.Format("{0}{1}_{2}_{3}.{4}", prefix, featureContext.FeatureInfo.Title, scenarioContext.ScenarioInfo.Title, pictureIndex, extension); foreach (var ch in Path.GetInvalidFileNameChars()) fileName = fileName.Replace(ch, '_'); return fileName; } }
public static void DisposeOfEmu(ScenarioContext context) { Assert.That(context != null); lock (context) { IEmuAutomationController emu = null; if (!context.TryGetValue(EmuControllerKey, out emu)) return; if (emu.DisplayInputController != null) emu.DisplayInputController.ReleaseWindowFromForeground(); emu.Dispose(); context.Remove(EmuControllerKey); } }
public static IAutomationController GetEmuAutomationController(ScenarioContext context, IConfiguration configuration) { Assert.That(context != null); Assert.That(configuration != null); lock (context) { IAutomationController emu = null; if (context.TryGetValue(EmuControllerKey, out emu)) return emu; emu = Server.Core.Loader.LoadFrom(configuration.AutomationControllerName); emu.Trace += (sender, args) => StepFlowOutputHelpers.Write(args.Message); emu.Start( configuration.ControllerInitialisationString, configuration.AutomationIdentification); context[EmuControllerKey] = emu; return emu; } }
public static IEmuAutomationController GetEmuAutomationController(ScenarioContext context, IConfiguration configuration) { Assert.That(context != null); Assert.That(configuration != null); lock (context) { IEmuAutomationController emu = null; if (context.TryGetValue(EmuControllerKey, out emu)) return emu; emu = new EmuAutomationController.EmuAutomationController(); emu.Trace += (sender, args) => StepFlowOutputHelpers.Write(args.Message); emu.Start( configuration.BindingAddress == null ? null : new Uri(configuration.BindingAddress), configuration.AutomationIdentification); if (emu.DisplayInputController != null) emu.DisplayInputController.EnsureWindowIsInForeground(); context[EmuControllerKey] = emu; return emu; } }
public static void StopHost(ScenarioContext context) { Assert.That(context != null); lock (context) { IAutomationController emu = null; if (!context.TryGetValue(EmuControllerKey, out emu)) return; emu.Stop(); } }