public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { var pattern = new Regex("(#.+?) *: *(.+)"); var matcher = pattern.Match(commandCall.Expression); if (!matcher.Success) { throw new InvalidOperationException("The expression for a \"verifyRows\" should be of the form: #var : collectionExpr"); } var loopVariableName = matcher.Groups[1].Value; var iterableExpression = matcher.Groups[2].Value; var obj = evaluator.Evaluate(iterableExpression); Check.NotNull(obj, "Expression returned null (should be an IEnumerable)."); Check.IsTrue(obj is IEnumerable, obj.GetType() + " is not IEnumerable"); Check.IsTrue(!(obj is IDictionary), obj.GetType() + " does not have a predictable iteration order"); var iterable = (IEnumerable)obj; var tableSupport = new TableSupport(commandCall); var detailRows = tableSupport.GetDetailRows(); AnnounceExpressionEvaluated(commandCall.Element); int index = 0; foreach (var loopVar in iterable) { evaluator.SetVariable(loopVariableName, loopVar); Row detailRow; if (detailRows.Count > index) { detailRow = detailRows[index]; } else { detailRow = tableSupport.AddDetailRow(); AnnounceSurplusRow(detailRow.RowElement); } tableSupport.CopyCommandCallsTo(detailRow); commandCall.Children.Verify(evaluator, resultRecorder); index++; } for (; index < detailRows.Count; index++) { Row detailRow = detailRows[index]; resultRecorder.Failure(string.Format("missing row {0}", detailRow), commandCall.Element.ToXml()); AnnounceMissingRow(detailRow.RowElement); } }
public void Verify(CommandCall commandCall, IEvaluator evaluator, IResultRecorder resultRecorder) { var pattern = new Regex("(#.+?) *: *(.+)"); var matcher = pattern.Match(commandCall.Expression); if (!matcher.Success) { throw new InvalidOperationException("The expression for a \"verifyRows\" should be of the form: #var : collectionExpr"); } var loopVariableName = matcher.Groups[1].Value; var iterableExpression = matcher.Groups[2].Value; var obj = evaluator.Evaluate(iterableExpression); Check.NotNull(obj, "Expression returned null (should be an IEnumerable)."); Check.IsTrue(obj is IEnumerable, obj.GetType() + " is not IEnumerable"); Check.IsTrue(!(obj is IDictionary), obj.GetType() + " does not have a predictable iteration order"); var iterable = (IEnumerable)obj; var tableSupport = new TableSupport(commandCall); var detailRows = tableSupport.GetDetailRows(); AnnounceExpressionEvaluated(commandCall.Element); int index = 0; foreach (var loopVar in iterable) { evaluator.SetVariable(loopVariableName, loopVar); Row detailRow; if (detailRows.Count > index) { detailRow = detailRows[index]; } else { detailRow = tableSupport.AddDetailRow(); AnnounceSurplusRow(detailRow.RowElement); } tableSupport.CopyCommandCallsTo(detailRow); commandCall.Children.Verify(evaluator, resultRecorder); index++; } for (; index < detailRows.Count; index++) { Row detailRow = detailRows[index]; resultRecorder.Record(Result.Failure); AnnounceMissingRow(detailRow.RowElement); } }
/// <summary> /// 设置请求分页数据 /// </summary> protected void startPage(IHttpContextAccessor httpContextAccessor) { //to do 这里用的是mybatis的 pagehelper插件 //net core 并没有这个插件,所以要做自己的分页 //这里就是拿请求中的分页参数 HttpRequest request = httpContextAccessor.HttpContext.Request; PageDomain pageDomain = TableSupport.buildPageRequest(request); // int? pageNum = pageDomain.PageNum; // int? pageSize = pageDomain.PageSize; // if ( pageNum.HasValue && pageSize.HasValue) // { // string orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); // PageHelper.startPage(pageNum, pageSize, orderBy); // } }
public void Execute(CommandCall commandCall, global::Concordion.Api.IEvaluator evaluator, global::Concordion.Api.IResultRecorder resultRecorder) { TableSupport tableSupport = new TableSupport(commandCall); IList<Row> detailRows = tableSupport.GetDetailRows(); foreach (Row detailRow in detailRows) { if (detailRow.GetCells().Count != tableSupport.ColumnCount) { throw new Exception("The <table> 'execute' command only supports rows with an equal number of columns."); } commandCall.Element = detailRow.RowElement; tableSupport.CopyCommandCallsTo(detailRow); commandCall.Execute(evaluator, resultRecorder); } }
public void Execute(CommandCall commandCall, global::Concordion.Api.IEvaluator evaluator, global::Concordion.Api.IResultRecorder resultRecorder) { TableSupport tableSupport = new TableSupport(commandCall); IList <Row> detailRows = tableSupport.GetDetailRows(); foreach (Row detailRow in detailRows) { if (detailRow.GetCells().Count != tableSupport.ColumnCount) { throw new Exception("The <table> 'execute' command only supports rows with an equal number of columns."); } commandCall.Element = detailRow.RowElement; tableSupport.CopyCommandCallsTo(detailRow); commandCall.Execute(evaluator, resultRecorder); } }
public Response AddTableSupport(TableSupport tableSupport) { //TODO debe ir una validacion por modelos y una respuesta respectiva y se deben crear los mensajes if (_config.AddConfigTable(tableSupport)) { return(new Response() { CodHttp = HttpStatusCode.Created.GetHashCode(), ObjectResponse = tableSupport }); } else { return(new Response() { CodHttp = HttpStatusCode.BadRequest.GetHashCode(), ObjectResponse = null }); } }
public bool AddConfigTable(TableSupport tableSupport) { return(_liteDb.Insert(tableSupport) != null); }