Example #1
0
        public void Circle_NegativeTest()
        {
            var model = dynSettings.Controller.DynamoModel;

            string openPath = Path.Combine(GetTestDirectory(), @"core\GeometryTestFiles\Circle_NegativeTest.dyn");

            model.Open(openPath);

            // check all the nodes and connectors are loaded
            Assert.AreEqual(14, model.CurrentWorkspace.Nodes.Count);
            Assert.AreEqual(20, model.CurrentWorkspace.Connectors.Count);

            // run expression
            dynSettings.Controller.RunExpression(null);

            // Verification for Circle with CircleWithZeroVectorLength which is invalid
            // though this test case is now passing but after fixing defect this test case will fail and need to update this test case.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <CircleNode>("b1d4583f-fac2-4459-b266-9f69dd538d8c");

            Assert.IsTrue(Utils.Convert(getGeometry1.GetValue(0), ref geometry1));

            Autodesk.LibG.Circle circle = geometry1 as Autodesk.LibG.Circle;
            Assert.AreNotEqual(null, circle);

            // Verification for Circle with CircleWithRadiusZero which is invalid
            // though this test case is now passing but after fixing defect this test case will fail and need to update this test case.
            Autodesk.LibG.Geometry geometry2 = null;
            var getGeometry2 = model.CurrentWorkspace.NodeFromWorkspace <CircleNode>("2094fe23-9f14-4fa4-ab2a-5dfc66dda6ef");

            Assert.IsTrue(Utils.Convert(getGeometry2.GetValue(0), ref geometry2));

            Autodesk.LibG.Circle circle2 = geometry1 as Autodesk.LibG.Circle;
            Assert.AreNotEqual(null, circle);

            //// run the expression
            //Assert.Throws<AssertionException>(() =>
            //    {
            //        dynSettings.Controller.RunExpression(null);
            //    });
        }
Example #2
0
        public void CircleTest()
        {
            var model = dynSettings.Controller.DynamoModel;

            string openPath = Path.Combine(GetTestDirectory(), @"core\GeometryTestFiles\CircleTest.dyn");

            model.Open(openPath);

            // check all the nodes and connectors are loaded
            Assert.AreEqual(7, model.CurrentWorkspace.Nodes.Count);
            Assert.AreEqual(10, model.CurrentWorkspace.Connectors.Count);

            // run the expression
            dynSettings.Controller.RunExpression(null);

            // Verification for X coordinate of CenterPoint node.
            Autodesk.LibG.Geometry geometry1 = null;
            var getGeometry1 = model.CurrentWorkspace.NodeFromWorkspace <Point3DNode>("753356e5-4025-46b9-a688-8a2e20e482fc");

            Assert.IsTrue(Utils.Convert(getGeometry1.GetValue(0), ref geometry1));

            Autodesk.LibG.Point point1 = geometry1 as Autodesk.LibG.Point;
            Assert.AreNotEqual(null, point1);
            Assert.AreEqual(0, point1.x());

            // Verification for Circle node.
            Autodesk.LibG.Geometry geometry = null;
            var getGeometry = model.CurrentWorkspace.NodeFromWorkspace <CircleNode>("3382f192-30e7-49bf-92f0-c24504d498b5");

            Assert.IsTrue(Utils.Convert(getGeometry.GetValue(0), ref geometry));

            Autodesk.LibG.Circle circle = geometry as Autodesk.LibG.Circle;
            Assert.AreNotEqual(null, circle);
            //Assert.AreEqual(point1, circle.center_point());
            Assert.AreEqual(0, circle.center_point().x());
        }