예제 #1
0
        public void Union_AffectedObjectsAreChildren()
        {
            var union = new Cube().Union(new Cylinder());
            var children = union.Children();

            Assert.IsTrue(children.ElementAt(0).GetType() == typeof(Cube));
            Assert.IsTrue(children.ElementAt(1).GetType() == typeof(Cylinder));
        }
예제 #2
0
        public void Union_ChainingAdditionAddsToTheSameUnion()
        {
            var obj = new Cube() + new Sphere() + new Text3D("WOW!") + new Cylinder().Translate(1, 2, 5);
            var union = new Sphere().Union(new Cube());

            var unionChildrenCount = obj.Children().Where(child => child.GetType() == union.GetType()).Count();

            Assert.AreEqual(0, unionChildrenCount);
        }
예제 #3
0
        public void Difference_ChainingMinusOperationAddsToTheSameDifferenceObject()
        {
            var obj = new Cube() - new Sphere() - new Text3D("WOW!") - new Cylinder().Translate(1, 2, 5);
            var diff = new Sphere().Difference(new Cube());

            var childrenThatAreDiffs = obj.Children().Where(child => child.GetType() == diff.GetType()).Count();

            Assert.AreEqual(0, childrenThatAreDiffs);
        }
예제 #4
0
        public void OSCADObject_EachOscadObjectChildHasDistinctId()
        {
            var obj = new Cube(5, 5, 10, true)
                .Translate(0, 5, 10).Rotate(0, 90, 0)
                .Translate(0, 0, 10).Scale(1, 1, 2);

            List<int> ids = obj.Children().Select(child => child.Id).ToList();
            ids.Add(obj.Id);

            Assert.AreEqual(ids.Count, ids.Distinct().Count());
        }