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)); }
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); }
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); }
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()); }