Ejemplo n.º 1
0
        public void OSCADObject_ClonesContainChildren()
        {
            var text = new Text3D("Hi").Rotate(90, 0, 0);

            var clone = text.Clone();

            //Clone has a child, and it should be the same thing
            Assert.IsTrue(clone.Children().Count() == 1);
            Assert.IsTrue(clone.Children().FirstOrDefault().GetType() == text.Children().FirstOrDefault().GetType());

            //But the child should be a different instance
            Assert.IsFalse(clone.Children().FirstOrDefault() == text.Children().FirstOrDefault());
        }
Ejemplo n.º 2
0
        public void OSCADObject_ChildrenWithRecursiveFalseReturnsOnlyDirectChildren()
        {
            var firstLevel = new Sphere().Union(new Cube(), new Sphere(), new Cylinder());
            firstLevel.Name = "Union";
            var secondLevel = new Text3D() { Name = "Text" }.Difference(firstLevel);

            var children = secondLevel.Children(false).ToList();

            Assert.AreEqual("Text", children[0].Name);
            Assert.AreEqual("Union", children[1].Name);
        }