public void EnumerateNodes() { var parser = new UmbracoXmlParser(_tempFile); var enumerator = parser.GetNodes().GetEnumerator(); enumerator.MoveNext(); Assert.AreEqual(1095, enumerator.Current.Id); Assert.AreEqual(1, enumerator.Current.Level); Assert.AreEqual("home", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1096, enumerator.Current.Id); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("home/products", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1097, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/tattoo", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1097 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Tattoo" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1098, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/unicorn", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1098 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Unicorn" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1099, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/ping-pong-ball", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1099 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Ping Pong Ball" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1100, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/bowling-ball", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1100 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Bowling Ball" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1101, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/jumpsuit", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1101 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Jumpsuit" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1102, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/banjo", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1102 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Banjo" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1103, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/knitted-west", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1103 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Knitted West" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1104, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/products/biker-jacket", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1096, 1104 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Products", "Biker Jacket" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1105, enumerator.Current.Id); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("home/people", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1105 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "People" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1106, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/people/jan-skovgaard", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1105, 1106 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "People", "Jan Skovgaard" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1107, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/people/matt-brailsford", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1105, 1107 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "People", "Matt Brailsford" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1108, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/people/lee-kelleher", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1105, 1108 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "People", "Lee Kelleher" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1109, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/people/jeavon-leopold", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1105, 1109 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "People", "Jeavon Leopold" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1110, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/people/jeroen-breuer", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1105, 1110 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "People", "Jeroen Breuer" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1111, enumerator.Current.Id); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("home/about-us", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1111 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "About Us" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1112, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/about-us/about-this-starter-kit", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1111, 1112 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "About Us", "About this Starter Kit" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1113, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/about-us/todo-list-for-the-starter-kit", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1111, 1113 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "About Us", "Todo list for the Starter Kit" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1114, enumerator.Current.Id); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("home/blog", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1114 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Blog" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1115, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/blog/my-blog-post", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1114, 1115 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Blog", "My Blog Post" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1116, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/blog/another-one", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1114, 1116 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Blog", "Another one" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1117, enumerator.Current.Id); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("home/blog/this-will-be-great", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1114, 1117 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Blog", "This will be great" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1118, enumerator.Current.Id); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("home/contact", enumerator.Current.Url); CollectionAssert.AreEqual(new[] { 1095, 1118 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Home", "Contact" }, enumerator.Current.PathNames); }
public void EnumerateNodes() { var parser = new UmbracoXmlParser(_tempFile); var enumerator = parser.GetNodes().GetEnumerator(); enumerator.MoveNext(); Assert.AreEqual(1069, enumerator.Current.Id); Assert.AreEqual(null, enumerator.Current.ParentId); Assert.AreEqual("SiteRoot", enumerator.Current.Doctype); Assert.AreEqual(1, enumerator.Current.Level); Assert.AreEqual("Example Site", enumerator.Current.Name); Assert.AreEqual("example-site", enumerator.Current.Url); Assert.AreEqual(new DateTime(2014, 12, 12, 13, 23, 29), enumerator.Current.CreateDate); Assert.AreEqual(new DateTime(2016, 9, 1, 16, 45, 19), enumerator.Current.UpdateDate); Assert.AreEqual("admin", enumerator.Current.CreatorName); Assert.AreEqual("james", enumerator.Current.WriterName); Assert.AreEqual(1067, enumerator.Current.TemplateId); CollectionAssert.AreEqual(new[] { 1069 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Example Site" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1072, enumerator.Current.Id); Assert.AreEqual(1069, enumerator.Current.ParentId); Assert.AreEqual("Homepage", enumerator.Current.Doctype); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("Homepage", enumerator.Current.Name); Assert.AreEqual("example-site/homepage", enumerator.Current.Url); Assert.AreEqual(new DateTime(2014, 12, 15, 10, 1, 20), enumerator.Current.CreateDate); Assert.AreEqual(new DateTime(2016, 8, 30, 10, 16, 30), enumerator.Current.UpdateDate); Assert.AreEqual("admin", enumerator.Current.CreatorName); Assert.AreEqual("fred", enumerator.Current.WriterName); Assert.AreEqual(1067, enumerator.Current.TemplateId); CollectionAssert.AreEqual(new[] { 1069, 1072 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Example Site", "Homepage" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(2552, enumerator.Current.Id); Assert.AreEqual(1069, enumerator.Current.ParentId); Assert.AreEqual("Content", enumerator.Current.Doctype); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("Content", enumerator.Current.Name); Assert.AreEqual("example-site/content", enumerator.Current.Url); Assert.AreEqual(new DateTime(2015, 5, 22, 12, 10, 22), enumerator.Current.CreateDate); Assert.AreEqual(new DateTime(2016, 5, 18, 5, 44, 15), enumerator.Current.UpdateDate); Assert.AreEqual("sally", enumerator.Current.CreatorName); Assert.AreEqual("admin", enumerator.Current.WriterName); Assert.AreEqual(1067, enumerator.Current.TemplateId); CollectionAssert.AreEqual(new[] { 1069, 2552 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Example Site", "Content" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(1239, enumerator.Current.Id); Assert.AreEqual(1069, enumerator.Current.ParentId); Assert.AreEqual("CategoryPage", enumerator.Current.Doctype); Assert.AreEqual(2, enumerator.Current.Level); Assert.AreEqual("News", enumerator.Current.Name); Assert.AreEqual("example-site/news", enumerator.Current.Url); Assert.AreEqual(new DateTime(2015, 3, 25, 13, 42, 15), enumerator.Current.CreateDate); Assert.AreEqual(new DateTime(2016, 3, 1, 5, 39, 24), enumerator.Current.UpdateDate); Assert.AreEqual("admin", enumerator.Current.CreatorName); Assert.AreEqual("admin", enumerator.Current.WriterName); Assert.AreEqual(1067, enumerator.Current.TemplateId); CollectionAssert.AreEqual(new[] { 1069, 1239 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Example Site", "News" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(2447, enumerator.Current.Id); Assert.AreEqual(1239, enumerator.Current.ParentId); Assert.AreEqual("DateFolder", enumerator.Current.Doctype); Assert.AreEqual(3, enumerator.Current.Level); Assert.AreEqual("Oct 2014", enumerator.Current.Name); Assert.AreEqual("example-site/news/oct-2014", enumerator.Current.Url); Assert.AreEqual(new DateTime(2015, 5, 13, 12, 10, 32), enumerator.Current.CreateDate); Assert.AreEqual(new DateTime(2015, 5, 13, 12, 10, 32), enumerator.Current.UpdateDate); Assert.AreEqual("admin", enumerator.Current.CreatorName); Assert.AreEqual("admin", enumerator.Current.WriterName); Assert.AreEqual(0, enumerator.Current.TemplateId); CollectionAssert.AreEqual(new[] { 1069, 1239, 2447 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Example Site", "News", "Oct 2014" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(2448, enumerator.Current.Id); Assert.AreEqual(2447, enumerator.Current.ParentId); Assert.AreEqual("Article", enumerator.Current.Doctype); Assert.AreEqual(4, enumerator.Current.Level); Assert.AreEqual("People with No or Bad Credit Score", enumerator.Current.Name); Assert.AreEqual("example-site/news/oct-2014/people-with-bad-credit-score", enumerator.Current.Url); Assert.AreEqual(new DateTime(2015, 5, 13, 12, 10, 33), enumerator.Current.CreateDate); Assert.AreEqual(new DateTime(2015, 10, 22, 7, 42, 8), enumerator.Current.UpdateDate); Assert.AreEqual("angela", enumerator.Current.CreatorName); Assert.AreEqual("admin", enumerator.Current.WriterName); Assert.AreEqual(1067, enumerator.Current.TemplateId); CollectionAssert.AreEqual(new[] { 1069, 1239, 2447, 2448 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Example Site", "News", "Oct 2014", "People with No or Bad Credit Score" }, enumerator.Current.PathNames); enumerator.MoveNext(); Assert.AreEqual(2499, enumerator.Current.Id); Assert.AreEqual(2447, enumerator.Current.ParentId); Assert.AreEqual("Article", enumerator.Current.Doctype); Assert.AreEqual(4, enumerator.Current.Level); Assert.AreEqual("Make a Wise Decision by Comparing Price Online", enumerator.Current.Name); Assert.AreEqual("news/make-a-wise-decision", enumerator.Current.Url); Assert.AreEqual(new DateTime(2015, 5, 15, 10, 30, 43), enumerator.Current.CreateDate); Assert.AreEqual(new DateTime(2015, 6, 18, 16, 38, 31), enumerator.Current.UpdateDate); Assert.AreEqual("anish", enumerator.Current.CreatorName); Assert.AreEqual("anish", enumerator.Current.WriterName); Assert.AreEqual(1067, enumerator.Current.TemplateId); CollectionAssert.AreEqual(new[] { 1069, 1239, 2447, 2499 }, enumerator.Current.PathIds); CollectionAssert.AreEqual(new[] { "Example Site", "News", "Oct 2014", "Make a Wise Decision by Comparing Price Online" }, enumerator.Current.PathNames); }