Exemple #1
0
        public override void PostProcessAndValidate(IStepValidator stepValidator, Step step)
        {
            if (!step.Collections.Has(collection))
            {
                if (step.Collections.Count == 1)
                {
                    var clone = step.Collections.Single().CloneAs(collection);
                    step.Collections[collection] = clone;
                }
            }

            var section = findSection(step);

            if (section == null)
            {
                stepValidator.AddError("Missing step collection");
                return;
            }

            stepValidator.Start(section, null);

            var i = 0;

            foreach (var child in section.Children.OfType <Step>())
            {
                i++;
                stepValidator.Start(i, child);

                child.ProcessCells(cells, stepValidator);

                stepValidator.End(child);
            }

            stepValidator.End(section);
        }
        public override void PostProcessAndValidate(IStepValidator stepValidator, Step step)
        {
            if (errors.Any())
            {
                stepValidator.AddError("Grammar has errors");
            }

            step.ProcessCells(cells, stepValidator);
        }
Exemple #3
0
        public void ProcessCells(Cell[] cells, IStepValidator stepValidator)
        {
            if (cells == null || cells.Length == 0)
            {
                return;
            }

            if (StagedValues != null)
            {
                for (int i = 0; i < StagedValues.Length; i++)
                {
                    if (cells.Length <= i)
                    {
                        break;
                    }

                    Values[cells[i].Key] = StagedValues[i];
                }
            }

            foreach (var cell in cells)
            {
                if (Values.ContainsKey(cell.Key))
                {
                    continue;
                }

                if (cell.DefaultValue.IsNotEmpty())
                {
                    Values[cell.Key] = cell.DefaultValue;
                }
                else
                {
                    stepValidator.AddError($"Missing value for '{cell.Key}'");
                }
            }
        }
Exemple #4
0
        public override void PostProcessAndValidate(IStepValidator stepValidator, Step step)
        {
            if (!step.Collections.Has(collection))
            {
                if (step.Collections.Count == 1)
                {
                    var clone = step.Collections.Single().CloneAs(collection);
                    step.Collections[collection] = clone;
                }
            }

            var section = findSection(step);
            if (section == null)
            {
                stepValidator.AddError("Missing step collection");
                return;
            }

            stepValidator.Start(section, null);

            var i = 0;
            foreach (var child in section.Children.OfType<Step>())
            {
                i++;
                stepValidator.Start(i, child);

                child.ProcessCells(cells, stepValidator);

                stepValidator.End(child);
            }

            stepValidator.End(section);
        }
Exemple #5
0
        public void ProcessCells(Cell[] cells, IStepValidator stepValidator)
        {
            if (cells == null || cells.Length == 0) return;

            if (StagedValues != null)
            {
                for (int i = 0; i < StagedValues.Length; i++)
                {
                    if (cells.Length <= i) break;

                    Values[cells[i].Key] = StagedValues[i];
                }
            }

            foreach (var cell in cells)
            {
                if (Values.ContainsKey(cell.Key)) continue;

                if (cell.DefaultValue.IsNotEmpty())
                {
                    Values[cell.Key] = cell.DefaultValue;
                }
                else
                {
                    stepValidator.AddError($"Missing value for '{cell.Key}'");
                }
            }
        }
Exemple #6
0
        public override void PostProcessAndValidate(IStepValidator stepValidator, Step step)
        {
            if (errors.Any())
            {
                stepValidator.AddError("Grammar has errors");
            }

            step.ProcessCells(cells, stepValidator);
        }