Example #1
0
 public Criterion(Block block)
 {
     Name = block.Name;
     CriterionType = block.BlockType;
     Tags = block.Tags;
     Steps = new List<CriterionStep>();
     BeforeCriteria = new List<Criterion>();
     AfterCriterion = new List<Criterion>();
 }
Example #2
0
        public List<Block> BuildBlocks(List<string> lines)
        {
            blocks = new List<Block>();

            var currentLine = 0;

            var currentTags = new List<Tag>();

            var block = new Block();

            foreach (string line in lines)
            {
                if (LanguageElements.BlockTypes.Any(t => line.StartsWith(t)))
                {
                    block.EndIndex = currentLine - 1;

                    if (!string.IsNullOrEmpty(block.BlockType))
                        blocks.Add(FinishBlock(block, currentTags, lines));

                    block = new Block();

                    block.BlockType = line.Split(':')[0].Trim();

                    block.Name = line.Split(':')[1].Trim();

                    block.StartIndex = currentLine;

                    currentTags = GetTags(lines, currentLine);
                }

                currentLine++;
            }

            block.EndIndex = currentLine - 1;

            blocks.Add(FinishBlock(block, currentTags, lines));

            return blocks;
        }
Example #3
0
        public Block FinishBlock(Block block, List<Tag> tags, List<string> lines)
        {
            block.Tags = tags;

            block.Lines.AddRange(lines.GetRange(block.StartIndex + 1, block.EndIndex - block.StartIndex));

            block.Lines.RemoveAll(l => l.StartsWith(LanguageElements.TagToken));

            return block;
        }