Ejemplo n.º 1
0
        public static TECScopeBranch TestScopeBranch(Random rand, int maxDepth)
        {
            TECScopeBranch branch = new TECScopeBranch();

            branch.AssignTestLabel();
            if (maxDepth > 0)
            {
                int nextMaxDepth = rand.Next(maxDepth);
                if (nextMaxDepth >= maxDepth)
                {
                    throw new Exception("This may cause an infinite loop.");
                }
                rand.RepeatAction(() => branch.Branches.Add(TestScopeBranch(rand, nextMaxDepth)), rand.Next(1, 5));
            }
            return(branch);
        }