Пример #1
0
        private void validate(string template, IEnumerable <Cell> cells, List <string> keys)
        {
            var errors = new ParseErrors(template);

            keys.ForEach(key =>
            {
                if (cells.FirstOrDefault(c => c.Key == key) == null)
                {
                    errors.MarkExtra(key);
                }
            });

            foreach (Cell cell in cells)
            {
                if (!keys.Contains(cell.Key))
                {
                    if (cell.IsBooleanResult())
                    {
                        continue;
                    }

                    errors.MarkMissing(cell.Key);
                }
            }

            errors.ThrowIfErrors();
        }
Пример #2
0
        private void validate(string template, IEnumerable<Cell> cells, List<string> keys)
        {
            var errors = new ParseErrors(template);
            keys.ForEach(key =>
            {
                if (cells.FirstOrDefault(c => c.Key == key) == null)
                {
                    errors.MarkExtra(key);
                }
            });

            foreach (Cell cell in cells)
            {
                if (!keys.Contains(cell.Key))
                {
                    if (cell.IsBooleanResult()) continue;

                    errors.MarkMissing(cell.Key);
                }
            }

            errors.ThrowIfErrors();
        }