public static string GetNextPictureName(FeatureContext featureContext, ScenarioContext scenarioContext)
        {
            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}.png",
                                                EmuShotPrefix,
                                                featureContext.FeatureInfo.Title,
                                                scenarioContext.ScenarioInfo.Title,
                                                pictureIndex);

                foreach (var ch in Path.GetInvalidFileNameChars())
                    fileName = fileName.Replace(ch, '_');

                return fileName;
            }
        }
        public ScenarioContextExtended(ScenarioContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.context = context;
        }
Пример #3
0
        public CommonSteps(ScenarioContext scenarioContext)
        {
            if (scenarioContext == null)
            {
                throw new ArgumentNullException("scenarioContext");
            }

            this.scenarioContext = scenarioContext;

            this.driverContext = this.scenarioContext["DriverContext"] as DriverContext;
        }
        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;
            }
        }
Пример #7
0
 public RolesSteps(ScenarioContext scenarioContext, CleanupPool cleanupPool)
 {
   this.scenarioContext = scenarioContext;
   this.cleanupPool = cleanupPool;
 }
        public static Random GetRandom(FeatureContext featureContext, ScenarioContext scenarioContext)
        {
            Assert.NotNull(featureContext);
            Assert.NotNull(scenarioContext);

            object randomObject;
            if (featureContext.TryGetValue(EmuRandomGeneratorKey, out randomObject))
            {
                if (randomObject is Random)
                    return randomObject as Random;
            }

            var random = new Random();
            featureContext[EmuRandomGeneratorKey] = random;
            return random;
        }
 public static string GetNextPictureName(FeatureContext featureContext, ScenarioContext scenarioContext)
 {
     return GetNextSupportingInfoFileName(featureContext, scenarioContext, EmuShotPrefix, "png");
 }
 public NewDriveSteps(ScenarioContext scenarioContext)
     : base(scenarioContext)
 {
 }
        public static void StopHost(ScenarioContext context)
        {
            Assert.That(context != null);

            lock (context)
            {
                IAutomationController emu = null;
                if (!context.TryGetValue(EmuControllerKey, out emu))
                    return;

                emu.Stop();
            }
        }
Пример #12
0
 public Hooks(CurrentScenarioContext currentScenarioContext, ScenarioContext scenarioContext)
 {
     this.CurrentScenarioContext = currentScenarioContext;
     this.scenarioContext = scenarioContext;
 }
Пример #13
0
 internal static void DisableSingletonInstance()
 {
     isCurrentDisabled = true;
     Thread.MemoryBarrier();
     current = null;
 }
Пример #14
0
 public GetItemsStep(ScenarioContext scenarioContext)
     : base(scenarioContext)
 {
 }