Esempio n. 1
0
        /// <summary>
        /// Create an instance of ICommand object and ready to be execute
        /// </summary>
        /// <param name="testStep"></param>
        /// <param name="driver"></param>
        /// <returns></returns>
        public static IWebCommand Activate(TestStep testStep)
        {
            if (string.IsNullOrWhiteSpace(testStep.Action))
                throw new Exception(testStep.Action + " is not a valid command.");

            var key = testStep.Action.Trim().ToLower();

            if (!_commands.ContainsKey(key))
                throw new Exception(testStep.Action + " is not a valid command.");

            Assembly assembly = typeof (IWebCommand).Assembly;
            var className = _commands[key];

            return (IWebCommand) Activator.CreateInstance(assembly.GetType(className), testStep);
        }
Esempio n. 2
0
 /// <summary>
 /// Adding test step to form a complete test case
 /// </summary>
 /// <param name="testStep"></param>
 /// <returns></returns>
 public TestCase Add(TestStep testStep)
 {
     this.steps.Add(testStep);
     return this;
 }
Esempio n. 3
0
 protected AbstractCommand(TestStep testStep)
 {
     this.TestStep = testStep;
 }
Esempio n. 4
0
 public static IWebCommand Activate(TestStep testStep, IWebDriver driver)
 {
     return Activate(testStep).SetDriver(driver);
 }