Esempio n. 1
0
 private void AssertChildCount(VifObject vif, int expectedCount)
 {
     if (expectedCount == 0)
     {
         Assert.IsFalse(vif.HasChildren);
     }
     else
     {
         Assert.IsTrue(vif.HasChildren);
     }
     Assert.AreEqual(expectedCount, vif.Children.Count());
 }
 private void AppendLines(VifObject vif, List<string> lines)
 {
     var list = vif.Lines.ToList();
     if (!vif.HasChildren)
     {
         lines.AddRange(list);
         return;
     }
     //dump end statement
     lines.AddRange(list.Take(list.Count - 1));
     foreach (var child in vif.Children)
     {
         AppendLines(child, lines);
     }
     lines.Add(list.Last());
 }
Esempio n. 3
0
 private static VifObject DoBuild(IEnumerable<string> lines)
 {
     var current = new VifObject {IsRoot = true};
     foreach (var line in lines)
     {
         if (ObjectInlineRegex.IsMatch(line))
         {
             var vif = new VifObject();
             vif.AddBeginObjectLine(line);
             vif.Parent = current;
             current = vif;
             continue;
         }
         if (EndOfObjectRegex.IsMatch(line))
         {
             current.AddEndOfObjectLine(line);
             current = current.Parent;
             continue;
         }
         current.AddLine(line);
     }
     return current;
 }
Esempio n. 4
0
 private void AddChild(VifObject vif)
 {
     _children.Add(vif);
 }
Esempio n. 5
0
 public void Add(VifObject vif)
 {
     _vifs.Add(vif);
 }