Esempio n. 1
0
        public void TestChildren()
        {
            YogaNode parent = new YogaNode();

            foreach (YogaNode node in parent)
            {
                Assert.Fail(node.ToString());
            }

            YogaNode child0 = new YogaNode();

            Assert.AreEqual(-1, parent.IndexOf(child0));
            parent.Insert(0, child0);
            foreach (YogaNode node in parent)
            {
                Assert.AreEqual(0, parent.IndexOf(node));
            }

            YogaNode child1 = new YogaNode();

            parent.Insert(1, child1);
            int index = 0;

            foreach (YogaNode node in parent)
            {
                Assert.AreEqual(index++, parent.IndexOf(node));
            }

            parent.RemoveAt(0);
            Assert.AreEqual(-1, parent.IndexOf(child0));
            Assert.AreEqual(0, parent.IndexOf(child1));

            parent.Clear();
            Assert.AreEqual(0, parent.Count);

            parent.Clear();
            Assert.AreEqual(0, parent.Count);
        }