Beispiel #1
0
        public void MakeDifferentialTree()
        {
            var struc = new Profile.ProfileStructureComponent();

            struc.Differential         = new Profile.ConstraintComponent();
            struc.Differential.Element = new List <Profile.ElementComponent>();
            var e = struc.Differential.Element;

            e.Add(new Profile.ElementComponent()
            {
                Path = "A.B.C1"
            });
            e.Add(new Profile.ElementComponent()
            {
                Path = "A.B.C1"
            });
            e.Add(new Profile.ElementComponent()
            {
                Path = "A.B.C2"
            });
            e.Add(new Profile.ElementComponent()
            {
                Path = "A.B"
            });
            e.Add(new Profile.ElementComponent()
            {
                Path = "A.B.C1.D"
            });
            e.Add(new Profile.ElementComponent()
            {
                Path = "A.D.F"
            });

            var tree = new DifferentialTreeConstructor(struc.Differential).MakeTree();

            Assert.IsNotNull(tree);

            var nav = new ElementNavigator(tree);

            Assert.AreEqual(10, nav.Count);

            Assert.IsTrue(nav.MoveToChild("A"));
            Assert.IsTrue(nav.MoveToChild("B"));
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToNext("C1"));
            Assert.IsTrue(nav.MoveToNext("C2"));

            Assert.IsTrue(nav.MoveToParent());                    // 1st A.B
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.B"); // (now) 2nd A.B
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToChild("D"));

            Assert.IsTrue(nav.MoveToParent());  // A.B.C1
            Assert.IsTrue(nav.MoveToParent());  // A.B (2nd)
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.D");
            Assert.IsTrue(nav.MoveToChild("F"));
        }
Beispiel #2
0
        public void MakeDifferentialTree()
        {
            var e = new List <ElementDefinition>();

            e.Add(new ElementDefinition()
            {
                Path = "A.B.C1"
            });
            e.Add(new ElementDefinition()
            {
                Path = "A.B.C1"
            });
            e.Add(new ElementDefinition()
            {
                Path = "A.B.C2"
            });
            e.Add(new ElementDefinition()
            {
                Path = "A.B"
            });
            e.Add(new ElementDefinition()
            {
                Path = "A.B.C1.D"
            });
            e.Add(new ElementDefinition()
            {
                Path = "A.D.F"
            });

            var tree = new DifferentialTreeConstructor(e).MakeTree();

            Assert.IsNotNull(tree);

            var nav = new ElementNavigator(tree);

            Assert.AreEqual(10, nav.Count);

            Assert.IsTrue(nav.MoveToChild("A"));
            Assert.IsTrue(nav.MoveToChild("B"));
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToNext("C1"));
            Assert.IsTrue(nav.MoveToNext("C2"));

            Assert.IsTrue(nav.MoveToParent());                    // 1st A.B
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.B"); // (now) 2nd A.B
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToChild("D"));

            Assert.IsTrue(nav.MoveToParent());  // A.B.C1
            Assert.IsTrue(nav.MoveToParent());  // A.B (2nd)
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.D");
            Assert.IsTrue(nav.MoveToChild("F"));
        }
        public void MakeDifferentialTree()
        {
            var struc = new Profile.ProfileStructureComponent();
            struc.Differential = new Profile.ConstraintComponent();
            struc.Differential.Element = new List<Profile.ElementComponent>();
            var e = struc.Differential.Element;

            e.Add(new Profile.ElementComponent() { Path = "A.B.C1" });
            e.Add(new Profile.ElementComponent() { Path = "A.B.C1" });
            e.Add(new Profile.ElementComponent() { Path = "A.B.C2" });
            e.Add(new Profile.ElementComponent() { Path = "A.B" });
            e.Add(new Profile.ElementComponent() { Path = "A.B.C1.D" });
            e.Add(new Profile.ElementComponent() { Path = "A.D.F" });

            var tree = new DifferentialTreeConstructor(struc.Differential).MakeTree();
            Assert.IsNotNull(tree);

            var nav = new ElementNavigator(tree);
            Assert.AreEqual(10, nav.Count);

            Assert.IsTrue(nav.MoveToChild("A"));
            Assert.IsTrue(nav.MoveToChild("B"));
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToNext("C1"));
            Assert.IsTrue(nav.MoveToNext("C2"));

            Assert.IsTrue(nav.MoveToParent());  // 1st A.B
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.B");  // (now) 2nd A.B
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToChild("D"));

            Assert.IsTrue(nav.MoveToParent());  // A.B.C1
            Assert.IsTrue(nav.MoveToParent());  // A.B (2nd)
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.D");
            Assert.IsTrue(nav.MoveToChild("F"));
        }
        public void MakeDifferentialTree()
        {
            var e = new List<ElementDefinition>();

            e.Add(new ElementDefinition() { Path = "A.B.C1" });
            e.Add(new ElementDefinition() { Path = "A.B.C1" });
            e.Add(new ElementDefinition() { Path = "A.B.C2" });
            e.Add(new ElementDefinition() { Path = "A.B" });
            e.Add(new ElementDefinition() { Path = "A.B.C1.D" });
            e.Add(new ElementDefinition() { Path = "A.D.F" });

            var tree = new DifferentialTreeConstructor(e).MakeTree();
            Assert.IsNotNull(tree);

            var nav = new ElementNavigator(tree);
            Assert.AreEqual(10, nav.Count);

            Assert.IsTrue(nav.MoveToChild("A"));
            Assert.IsTrue(nav.MoveToChild("B"));
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToNext("C1"));
            Assert.IsTrue(nav.MoveToNext("C2"));

            Assert.IsTrue(nav.MoveToParent());  // 1st A.B
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.B");  // (now) 2nd A.B
            Assert.IsTrue(nav.MoveToChild("C1"));
            Assert.IsTrue(nav.MoveToChild("D"));

            Assert.IsTrue(nav.MoveToParent());  // A.B.C1
            Assert.IsTrue(nav.MoveToParent());  // A.B (2nd)
            Assert.IsTrue(nav.MoveToNext() && nav.Path == "A.D");
            Assert.IsTrue(nav.MoveToChild("F"));
        }