for Push.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KssSmaPlaLib.AutoTest.Script.Parse.Function
|
||||
{
|
||||
public class FunctionTryUxer
|
||||
{
|
||||
public static bool TryFunction(string input, out string functionName, out List<string> funcArgList,out string resultMessage)
|
||||
{
|
||||
functionName = "";
|
||||
funcArgList = new List<string>();
|
||||
resultMessage = string.Empty;
|
||||
|
||||
var match = Regex.Match(input, @"^(\w+)\((.*?)\)$");
|
||||
if (match.Success)
|
||||
{
|
||||
functionName = match.Groups[1].Value;
|
||||
var args = match.Groups[2].Value;
|
||||
if (!string.IsNullOrWhiteSpace(args))
|
||||
{
|
||||
funcArgList.AddRange(args.Split(','));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
resultMessage = $"シグネチャ形式が不正です。[シグネチャ:{input}]";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using DocumentFormat.OpenXml.Math;
|
||||
using KssSmaPlaLib.AutoTest.Command.Alias;
|
||||
using KssSmaPlaLib.AutoTest.Script.Models;
|
||||
using KssSmaPlaLib.AutoTest.Script.Parse.Function;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace KssSmaPlaLib.AutoTest.Script.Parse
|
||||
{
|
||||
public static class ParseTryUxer
|
||||
{
|
||||
public static bool TryParse(StepDTO raw, out ParsedStepDTO parsed, out string resultMessage)
|
||||
{
|
||||
resultMessage = string.Empty;
|
||||
parsed = new ParsedStepDTO(raw); // Raw注入
|
||||
|
||||
// ステップNo
|
||||
if (string.IsNullOrEmpty(raw.StepNo))
|
||||
{
|
||||
resultMessage = $"UIテストステップ:ステップ番号が指定されていません。";
|
||||
return false;
|
||||
}
|
||||
|
||||
// ステップ情報:シグネチャのバリデーション
|
||||
if (!FunctionTryUxer.TryFunction(raw.StepText, out var functionName, out var argList, out var messageForMe))
|
||||
{
|
||||
resultMessage = $"UIテストステップ:ステップ情報のシグネチャの変換に失敗しました。[エラー内容:{messageForMe}]";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 関数(機能)名
|
||||
if (!CommandAliasUxer.TryTranslate(functionName, out var commandEnum))
|
||||
{
|
||||
resultMessage = $"UIテストステップ:ステップ情報の関数(機能)名が未登録です。[関数(機能)名:{functionName}]";
|
||||
return false;
|
||||
}
|
||||
|
||||
// コマンド(enum値)
|
||||
parsed.Command = commandEnum;
|
||||
|
||||
// パラメータ
|
||||
parsed.Parameters = argList;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user