public static Command ParseCommand(this Command command, TestParameters testParameters, params Parameter[] parameters) { string[] strings = parameters.Select(parameter => " " + parameter.Name + " = " + parameter.Value).ToArray(); var commandName = "*" + command.GetType().Name.Replace("Command", ""); var scriptLines = new ScriptStringList(new[] { commandName }.Concat(strings).ToArray()); var commandCreationParam = new CommandCreationParam(scriptLines, 0, testParameters); command.ParseCommand(commandCreationParam); return(command); }
public override void ParseCommand(CommandCreationParam commandCreationParam){ base.ParseCommand(commandCreationParam); _size = this.ParameterValue("Size", new Size(1024, 768)); _topLeft = this.ParameterValue("TopLeft", new Point(0, 0)); var videoDir = ScriptsPath + @"\Images\ScreenCapture"; var testName = Logger.Instance.GetLogger<FileLogger>().CurrentTestLog.Name; _fileName = Path.Combine(videoDir, testName); _platformSuffix = this.IsWinCommand() ? ".Win" : ".Web"; if (!Directory.Exists(videoDir)) Directory.CreateDirectory(videoDir); else{ var files = Directory.GetFiles(videoDir, testName + "*"+_platformSuffix+".bmp"); for (int index = files.Length - 1; index >= 0; index--) { File.Delete(files[index]); } } }
public static T ConvertTo <T>(this Command command) where T : Command { var t = (T)typeof(T).CreateInstance(); var parameterList = command.Parameters; var extraParameterValue = parameterList?.ExtraParameter?.Value; if (extraParameterValue != null) { extraParameterValue = $"({extraParameterValue})"; } var firstLine = $"{(!command.ExpectException ? "*" : "!")}{typeof(T).Name.Replace("Command","")} {parameterList?.MainParameter?.Value} {extraParameterValue}"; var parameters = parameterList == null?new string[0]: parameterList.Select(parameter => $" {parameter.Name} = {parameter.Value}"); var lines = new [] { firstLine }.Concat(parameters).ToArray(); var param = new CommandCreationParam(new ScriptStringList(lines), 0); t.ParseCommand(param); return(t); }
public override void ParseCommand(CommandCreationParam commandCreationParam) { base.ParseCommand(commandCreationParam); _size = this.ParameterValue("Size", new Size(1024, 768)); _topLeft = this.ParameterValue("TopLeft", new Point(0, 0)); var videoDir = ScriptsPath + ImagesPath; var testName = Logger.Instance.GetLogger <FileLogger>().CurrentTestLog.Name; _fileName = Path.Combine(videoDir, testName); _platformSuffix = this.IsWinCommand() ? ".Win" : ".Web"; if (!Directory.Exists(videoDir)) { Directory.CreateDirectory(videoDir); } else { var files = Directory.GetFiles(videoDir, testName + "*" + _platformSuffix + ".bmp"); for (int index = files.Length - 1; index >= 0; index--) { File.Delete(files[index]); } } }
public override void ParseCommand(CommandCreationParam commandCreationParam) { base.ParseCommand(commandCreationParam); _scriptsPath = commandCreationParam.TestParameters.ScriptsPath; }
public override void ParseCommand(CommandCreationParam commandCreationParam){ base.ParseCommand(commandCreationParam); _testParameters = commandCreationParam.TestParameters; }
public override void ParseCommand(CommandCreationParam commandCreationParam) { base.ParseCommand(commandCreationParam); _testParameters = commandCreationParam.TestParameters; }