private static VifObject ReadVifFromFile(string path)
 {
     var lines = File.ReadAllLines(path);
     var builder = new VifObjectBuilder();
     var root = builder.Build(lines);
     return root;
 }
 public void CanBuildSimpleVif()
 {
     var lines = new[] {"object foo", "end"};
     var vifBuilder = new VifObjectBuilder();
     var single = vifBuilder.Build(lines);
     Assert.AreEqual(2, single.Lines.Count());
     AssertChildCount(single, 0);
 }
 public void CanBuildRecursiveVifWithExtralinesInBody()
 {
     var lines = new[] {"object VifPackage: TVifPackage", "object VifPackage: TVifPackage", "foo", "bar", "end", "foo", "bar", "end"};
     var vifBuilder = new VifObjectBuilder();
     var single = vifBuilder.Build(lines);
     Assert.AreEqual(4, single.Lines.Count());
     AssertChildCount(single, 1);
 }
 public void CanBuildThreeLayerRecursiveVif()
 {
     var lines = new[] {"object foo", "object bar", "object gombert", "end", "end", "end"};
     var vifBuilder = new VifObjectBuilder();
     var single = vifBuilder.Build(lines);
     AssertChildCount(single, 1);
     var firstChild = single.Children.Single();
     var grandChild = firstChild.Children.Single();
     AssertChildCount(firstChild, 1);
     AssertChildCount(grandChild, 0);
 }
 public void CanBuildSimpleRecursiveVif()
 {
     var lines = new[] {"object foo", "object bar", "end", "end"};
     var vifBuilder = new VifObjectBuilder();
     var first = vifBuilder.Build(lines);
     AssertChildCount(first, 1);
     var firstChild = first.Children.Single();
     AssertChildCount(firstChild, 0);
     Assert.AreEqual(2, firstChild.Lines.Count());
     Assert.AreEqual(2, first.Lines.Count());
 }
 public void CanBuildRecursiveVifWithTwoChildren()
 {
     var lines = new[] {"object foo", "object bar", "end", "object gombert", "end", "end"};
     var vifBuilder = new VifObjectBuilder();
     var first = vifBuilder.Build(lines);
     AssertChildCount(first, 2);
     foreach (var child in first.Children)
     {
         AssertChildCount(child, 0);
     }
 }