NUnit.Framework.Assert.That(TActual, NUnit.Framework.Constraints.IResolveConstraint, System.Func)

Here are the examples of the csharp api NUnit.Framework.Assert.That(TActual, NUnit.Framework.Constraints.IResolveConstraint, System.Func) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4637 Examples 7

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void ToolpathPointToolAxisTest()
        {
            _powerMill.LoadProject(TestFiles.SimplePmProject1);
            replacedert.That(_powerMill.ActiveProject.Toolpaths[0].ToolpathPointToolAxis(0, 0), Is.EqualTo(new Vector(0, 0, 1)));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void NumberOfLeadsTest()
        {
            _powerMill.LoadProject(TestFiles.SimplePmProject1);
            replacedert.That(_powerMill.ActiveProject.Toolpaths[0].NumberOfLeads, Is.EqualTo(0));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LeadsAndLinksOthersTimeTest()
        {
            _powerMill.LoadProject(TestFiles.SimplePmProject1);
            replacedert.That(_powerMill.ActiveProject.Toolpaths[0].LeadsAndLinksOthersTime, Is.EqualTo(TimeSpan.Parse("00:00:00")));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EditSurfaceSpeedWhileToolPathIsCalculatedTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var toolpath = _powerMill.ActiveProject.Toolpaths.First();

            var value = _random.Next(1, 1000);
            toolpath.SurfaceSpeed = value;

            var result = toolpath.SurfaceSpeed;
            replacedert.That(result, Is.EqualTo(value));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EditSpindleSpeedWhileToolPathIsCalculatedTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var toolpath = _powerMill.ActiveProject.Toolpaths.First();

            var value = _random.Next(1, 1000);
            toolpath.SpindleSpeed = value;

            var result = toolpath.SpindleSpeed;
            replacedert.That(result, Is.EqualTo(value));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EndPointApproachAlongWhileToolPathIsCalculatedTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var toolpath = _powerMill.ActiveProject.Toolpaths.First();
            foreach (var item in typeof(PointApproach).GetEnumValues())
            {
                toolpath.EndPointApproachAlong = (PointApproach) item;
                replacedert.That(toolpath.EndPointApproachAlong, Is.EqualTo(item));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EndPointMethodWhileToolPathIsCalculatedTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var toolpath = _powerMill.ActiveProject.Toolpaths.First();
            foreach (var item in typeof(EndPointMethod).GetEnumValues())
            {
                toolpath.EndPointMethod = (EndPointMethod) item;
                replacedert.That(toolpath.EndPointMethod, Is.EqualTo(item));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EndPointPositionXReadOnlyTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var toolpath = _powerMill.ActiveProject.Toolpaths.First();

            var result = toolpath.EndPointPositionX;
            replacedert.That(result, Is.GreaterThan(0));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LeadInTest()
        {
            var angle = _random.NextDouble();
            var distance = _random.Next();
            var radius = _random.NextDouble();
            var diameter = _random.Next();
            var rampFollow = (RampFollow) _random.Next(typeof(RampFollow).GetEnumValues().Length);
            var rampHeight = (RampHeight) _random.Next(typeof(RampHeight).GetEnumValues().Length);
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadIn;

            lead.Angle = angle;
            lead.Distance = distance;
            lead.Radius = radius;
            lead.Ramp.CircleDiameter = diameter;
            lead.Ramp.ClosedSegments = true;
            lead.Ramp.Extend = true;
            lead.Ramp.FiniteRamp = true;
            lead.Ramp.FiniteRampLenght = distance;
            lead.Ramp.Follow = rampFollow;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.RampHeight = rampHeight;
            lead.Ramp.RampHeightValue = distance;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.ZagAngle = true;
            lead.Ramp.ZagAngleMaximum = angle;

            replacedert.That(lead.LeadType, Is.EqualTo(LeadTypes.LeadIn));
            replacedert.That(lead.Angle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Distance.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Radius.Value, Is.EqualTo(radius).Within(TOLERANCE));
            replacedert.That(lead.Ramp.CircleDiameter.Value, Is.EqualTo(diameter).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ClosedSegments, Is.True);
            replacedert.That(lead.Ramp.Extend, Is.True);
            replacedert.That(lead.Ramp.FiniteRamp, Is.True);
            replacedert.That(lead.Ramp.FiniteRampLenght.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            replacedert.That(lead.Ramp.RampHeightValue.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ZagAngle, Is.True);
            replacedert.That(lead.Ramp.ZagAngleMaximum.Value, Is.EqualTo(angle).Within(TOLERANCE));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void MoveTypeOnLeadInTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadIn;
            foreach (var moveType in typeof(MoveType).GetEnumValues())
            {
                lead.MoveType = (MoveType) moveType;
                replacedert.That(lead.MoveType, Is.EqualTo(moveType));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

public void RampFollowOnLeadInTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadIn;
            foreach (var rampFollow in typeof(RampFollow).GetEnumValues())
            {
                lead.Ramp.Follow = (RampFollow) rampFollow;
                replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void RampHeightOnLeadInTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadIn;
            foreach (var rampHeight in typeof(RampHeight).GetEnumValues())
            {
                lead.Ramp.RampHeight = (RampHeight) rampHeight;
                replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LeadInSecondTest()
        {
            var angle = _random.NextDouble();
            var distance = _random.Next();
            var radius = _random.NextDouble();
            var diameter = _random.Next();
            var rampFollow = (RampFollow) _random.Next(typeof(RampFollow).GetEnumValues().Length);
            var rampHeight = (RampHeight) _random.Next(typeof(RampHeight).GetEnumValues().Length);
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadInSecond;

            lead.Angle = angle;
            lead.Distance = distance;
            lead.Radius = radius;
            lead.Ramp.CircleDiameter = diameter;
            lead.Ramp.ClosedSegments = true;
            lead.Ramp.Extend = true;
            lead.Ramp.FiniteRamp = true;
            lead.Ramp.FiniteRampLenght = distance;
            lead.Ramp.Follow = rampFollow;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.RampHeight = rampHeight;
            lead.Ramp.RampHeightValue = distance;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.ZagAngle = true;
            lead.Ramp.ZagAngleMaximum = angle;

            replacedert.That(lead.LeadType, Is.EqualTo(LeadTypes.LeadInSecond));
            replacedert.That(lead.Angle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Distance.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Radius.Value, Is.EqualTo(radius).Within(TOLERANCE));
            replacedert.That(lead.Ramp.CircleDiameter.Value, Is.EqualTo(diameter).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ClosedSegments, Is.True);
            replacedert.That(lead.Ramp.Extend, Is.True);
            replacedert.That(lead.Ramp.FiniteRamp, Is.True);
            replacedert.That(lead.Ramp.FiniteRampLenght.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            replacedert.That(lead.Ramp.RampHeightValue.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ZagAngle, Is.True);
            replacedert.That(lead.Ramp.ZagAngleMaximum.Value, Is.EqualTo(angle).Within(TOLERANCE));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LeadOutTest()
        {
            var angle = _random.NextDouble();
            var distance = _random.Next();
            var radius = _random.NextDouble();
            var diameter = _random.Next();
            var rampFollow = (RampFollow) _random.Next(typeof(RampFollow).GetEnumValues().Length);
            var rampHeight = (RampHeight) _random.Next(typeof(RampHeight).GetEnumValues().Length);
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadOut;

            lead.Angle = angle;
            lead.Distance = distance;
            lead.Radius = radius;
            lead.Ramp.CircleDiameter = diameter;
            lead.Ramp.ClosedSegments = true;
            lead.Ramp.Extend = true;
            lead.Ramp.FiniteRamp = true;
            lead.Ramp.FiniteRampLenght = distance;
            lead.Ramp.Follow = rampFollow;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.RampHeight = rampHeight;
            lead.Ramp.RampHeightValue = distance;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.ZagAngle = true;
            lead.Ramp.ZagAngleMaximum = angle;

            replacedert.That(lead.LeadType, Is.EqualTo(LeadTypes.LeadOut));
            replacedert.That(lead.Angle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Distance.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Radius.Value, Is.EqualTo(radius).Within(TOLERANCE));
            replacedert.That(lead.Ramp.CircleDiameter.Value, Is.EqualTo(diameter).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ClosedSegments, Is.True);
            replacedert.That(lead.Ramp.Extend, Is.True);
            replacedert.That(lead.Ramp.FiniteRamp, Is.True);
            replacedert.That(lead.Ramp.FiniteRampLenght.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            replacedert.That(lead.Ramp.RampHeightValue.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ZagAngle, Is.True);
            replacedert.That(lead.Ramp.ZagAngleMaximum.Value, Is.EqualTo(angle).Within(TOLERANCE));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void MoveTypeOnLeadOutTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadOut;
            foreach (var moveType in typeof(MoveType).GetEnumValues())
            {
                lead.MoveType = (MoveType) moveType;
                replacedert.That(lead.MoveType, Is.EqualTo(moveType));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

public void RampFollowOnLeadOutTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadIn;
            foreach (var rampFollow in typeof(RampFollow).GetEnumValues())
            {
                lead.Ramp.Follow = (RampFollow) rampFollow;
                replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void RampHeightOnLeadOutTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadOut;
            foreach (var rampHeight in typeof(RampHeight).GetEnumValues())
            {
                lead.Ramp.RampHeight = (RampHeight) rampHeight;
                replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LeadOutSecondTest()
        {
            var angle = _random.NextDouble();
            var distance = _random.Next();
            var radius = _random.NextDouble();
            var diameter = _random.Next();
            var rampFollow = (RampFollow) _random.Next(typeof(RampFollow).GetEnumValues().Length);
            var rampHeight = (RampHeight) _random.Next(typeof(RampHeight).GetEnumValues().Length);
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadOutSecond;

            lead.Angle = angle;
            lead.Distance = distance;
            lead.Radius = radius;
            lead.Ramp.CircleDiameter = diameter;
            lead.Ramp.ClosedSegments = true;
            lead.Ramp.Extend = true;
            lead.Ramp.FiniteRamp = true;
            lead.Ramp.FiniteRampLenght = distance;
            lead.Ramp.Follow = rampFollow;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.RampHeight = rampHeight;
            lead.Ramp.RampHeightValue = distance;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.ZagAngle = true;
            lead.Ramp.ZagAngleMaximum = angle;

            replacedert.That(lead.LeadType, Is.EqualTo(LeadTypes.LeadOutSecond));
            replacedert.That(lead.Angle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Distance.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Radius.Value, Is.EqualTo(radius).Within(TOLERANCE));
            replacedert.That(lead.Ramp.CircleDiameter.Value, Is.EqualTo(diameter).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ClosedSegments, Is.True);
            replacedert.That(lead.Ramp.Extend, Is.True);
            replacedert.That(lead.Ramp.FiniteRamp, Is.True);
            replacedert.That(lead.Ramp.FiniteRampLenght.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            replacedert.That(lead.Ramp.RampHeightValue.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ZagAngle, Is.True);
            replacedert.That(lead.Ramp.ZagAngleMaximum.Value, Is.EqualTo(angle).Within(TOLERANCE));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void FirstLeadInTest()
        {
            var angle = _random.NextDouble();
            var distance = _random.Next();
            var radius = _random.NextDouble();
            var diameter = _random.Next();
            var rampFollow = (RampFollow) _random.Next(typeof(RampFollow).GetEnumValues().Length);
            var rampHeight = (RampHeight) _random.Next(typeof(RampHeight).GetEnumValues().Length);
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.FirstLeadIn;

            lead.Angle = angle;
            lead.Distance = distance;
            lead.Radius = radius;
            lead.Ramp.CircleDiameter = diameter;
            lead.Ramp.ClosedSegments = true;
            lead.Ramp.Extend = true;
            lead.Ramp.FiniteRamp = true;
            lead.Ramp.FiniteRampLenght = distance;
            lead.Ramp.Follow = rampFollow;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.RampHeight = rampHeight;
            lead.Ramp.RampHeightValue = distance;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.ZagAngle = true;
            lead.Ramp.ZagAngleMaximum = angle;

            replacedert.That(lead.LeadType, Is.EqualTo(LeadTypes.FirstLeadIn));
            replacedert.That(lead.Angle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Distance.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Radius.Value, Is.EqualTo(radius).Within(TOLERANCE));
            replacedert.That(lead.Ramp.CircleDiameter.Value, Is.EqualTo(diameter).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ClosedSegments, Is.True);
            replacedert.That(lead.Ramp.Extend, Is.True);
            replacedert.That(lead.Ramp.FiniteRamp, Is.True);
            replacedert.That(lead.Ramp.FiniteRampLenght.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            replacedert.That(lead.Ramp.RampHeightValue.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ZagAngle, Is.True);
            replacedert.That(lead.Ramp.ZagAngleMaximum.Value, Is.EqualTo(angle).Within(TOLERANCE));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LastLeadOutTest()
        {
            var angle = _random.NextDouble();
            var distance = _random.Next();
            var radius = _random.NextDouble();
            var diameter = _random.Next();
            var rampFollow = (RampFollow) _random.Next(typeof(RampFollow).GetEnumValues().Length);
            var rampHeight = (RampHeight) _random.Next(typeof(RampHeight).GetEnumValues().Length);
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LastLeadOut;

            lead.Angle = angle;
            lead.Distance = distance;
            lead.Radius = radius;
            lead.Ramp.CircleDiameter = diameter;
            lead.Ramp.ClosedSegments = true;
            lead.Ramp.Extend = true;
            lead.Ramp.FiniteRamp = true;
            lead.Ramp.FiniteRampLenght = distance;
            lead.Ramp.Follow = rampFollow;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.RampHeight = rampHeight;
            lead.Ramp.RampHeightValue = distance;
            lead.Ramp.MaxZigAngle = angle;
            lead.Ramp.ZagAngle = true;
            lead.Ramp.ZagAngleMaximum = angle;

            replacedert.That(lead.LeadType, Is.EqualTo(LeadTypes.LastLeadOut));
            replacedert.That(lead.Angle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Distance.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Radius.Value, Is.EqualTo(radius).Within(TOLERANCE));
            replacedert.That(lead.Ramp.CircleDiameter.Value, Is.EqualTo(diameter).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ClosedSegments, Is.True);
            replacedert.That(lead.Ramp.Extend, Is.True);
            replacedert.That(lead.Ramp.FiniteRamp, Is.True);
            replacedert.That(lead.Ramp.FiniteRampLenght.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            replacedert.That(lead.Ramp.RampHeightValue.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Ramp.MaxZigAngle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Ramp.ZagAngle, Is.True);
            replacedert.That(lead.Ramp.ZagAngleMaximum.Value, Is.EqualTo(angle).Within(TOLERANCE));
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void MoveTypeOnLastLeadOutTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LastLeadOut;
            foreach (var moveType in typeof(MoveType).GetEnumValues())
            {
                lead.MoveType = (MoveType) moveType;
                replacedert.That(lead.MoveType, Is.EqualTo(moveType));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

public void RampFollowOnLastLeadOutTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadIn;
            foreach (var rampFollow in typeof(RampFollow).GetEnumValues())
            {
                lead.Ramp.Follow = (RampFollow) rampFollow;
                replacedert.That(lead.Ramp.Follow, Is.EqualTo(rampFollow));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void RampHeightOnLastLeadOutTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LastLeadOut;
            foreach (var rampHeight in typeof(RampHeight).GetEnumValues())
            {
                lead.Ramp.RampHeight = (RampHeight) rampHeight;
                replacedert.That(lead.Ramp.RampHeight, Is.EqualTo(rampHeight));
            }
        }

19 View Source File : PMToolPathTestGenerator.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LeadInExtensionTest()
        {
            var angle = _random.NextDouble();
            var distance = _random.Next();
            var radius = _random.NextDouble();
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var lead = _powerMill.ActiveProject.Toolpaths.First().Connections.LeadInExtension;

            lead.Angle = angle;
            lead.Distance = distance;
            lead.Radius = radius;

            replacedert.That(lead.LeadType, Is.EqualTo(LeadTypes.LeadInExtension));
            replacedert.That(lead.Angle.Value, Is.EqualTo(angle).Within(TOLERANCE));
            replacedert.That(lead.Distance.Value, Is.EqualTo(distance).Within(TOLERANCE));
            replacedert.That(lead.Radius.Value, Is.EqualTo(radius).Within(TOLERANCE));
        }

19 View Source File : Polyline.Test.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void
            WhenDensifyPolylineWithOneSegment_GivenLengthIsExactMultipleOfMaxInput_ThenEachNewSegmentsShouldBeInThatLength()
        {
            // Given
            Point startPoint = new Point(0, 0, 0);
            Point endPoint = new Point(0, 0, 10);
            double newMax = 2;
            var vector = new Vector(startPoint, endPoint);
            var length = vector.Magnitude;
            replacedert.IsTrue(length % newMax == 0);

            // When
            var poliline = new Polyline(new List<Point> {startPoint, endPoint});
            poliline.Densify(newMax);

            // Then
            replacedert.That(poliline.Count, Is.EqualTo(6));
            for (int i = 0; i < poliline.Count - 1; i++)
            {
                var p1 = poliline[i];
                var p2 = poliline[i + 1];
                var v = new Vector(p1, p2);
                replacedert.That((double) v.Magnitude, Is.EqualTo(newMax));
            }
        }

19 View Source File : Surface.Test.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void WhenGettingSurfaceNormal_ThenCheckItMatchesNormalInPowerShape()
        {
            var lateralsFile = Path.Combine(_testDirectory, "Laterals.pic");
            var laterals = Spline.ReadFromDUCTPictureFile(new FileSystem.File(lateralsFile));
            var longitudinalsFile = Path.Combine(_testDirectory, "Longitudinals.pic");
            var longitudinals = Spline.ReadFromDUCTPictureFile(new FileSystem.File(longitudinalsFile));
            var surface = new Surface(laterals, longitudinals);
            var normal = surface.GetNormal(1, 1);

            // It is enough to compare till 1 micro, usually the accuracies that we work are 10 micros
            // The normal also matches surface at 2 and 2
            var normalInPowerShape = new Vector(0.0, -0.138196, 0.990405);
            replacedert.That(normal.I.Value, Is.EqualTo(normalInPowerShape.I.Value).Within(0.001));
            replacedert.That(normal.J.Value, Is.EqualTo(normalInPowerShape.J.Value).Within(0.001));
            replacedert.That(normal.K.Value, Is.EqualTo(normalInPowerShape.K.Value).Within(0.001));
        }

19 View Source File : MSRFile.Test.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void MSRFileTwoEndsTogetherTest()
        {
            try
            {
                Geometry.MSRFile msrFile =
                    new Geometry.MSRFile(AppDomain.CurrentDomain.BaseDirectory + "\\..\\..\\TestFiles\\MSRTestFiles\\TwoEndsOK.msr",
                                         true);
                replacedert.That(msrFile.Points.Count, Is.EqualTo(6));
            }
            catch (Exception ex)
            {
                replacedert.Fail(ex.Message);
            }
            replacedert.Preplaced("Failed to throw exception");
        }

19 View Source File : MM.Test.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void WhenMultiplyMMWithInt_ThenResultShouldBeMM()
        {
            // When
            MM left = 3;
            int right = 6;
            var result = left * right;

            // Then
            replacedert.That(result.GetType(), Is.EqualTo(typeof(MM)));
            replacedert.That(result.Value, Is.EqualTo(18));
        }

19 View Source File : MM.Test.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void WhenMultiplyIntWithMM_ThenResultShouldBeMM()
        {
            // When
            int left = 6;
            MM right = 3;
            var result = left * right;

            // Then
            replacedert.That(result.GetType(), Is.EqualTo(typeof(MM)));
            replacedert.That(result.Value, Is.EqualTo(18));
        }

19 View Source File : MM.Test.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void WhenDivideMMByInt_ThenResultShouldBeMM()
        {
            // When
            MM left = 3;
            int right = 6;
            var result = left / right;

            // Then
            replacedert.That(result.GetType(), Is.EqualTo(typeof(MM)));
            replacedert.That(result, Is.EqualTo((MM) 0.5));
        }

19 View Source File : MM.Test.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void WhenDivideIntByMM_ThenResultShouldBeDouble()
        {
            // When
            int left = 6;
            MM right = 3;
            var result = left / right;

            // Then
            replacedert.That(result.GetType(), Is.EqualTo(typeof(double)));
            replacedert.That(result, Is.EqualTo(2));
        }

19 View Source File : PMModelsCollectionTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void ExportModelsTest()
        {
            var project = _powerMill.LoadProject(TestFiles.ExistingDentMillMasterProject);
            var exportFile = File.CreateTemporaryFile("dmt");
            project.Models.ExportAllModels(exportFile);

            // Reset quickly to ensure the busy flag is probably working
            _powerMill.Reset();

            // Check the existance of the DMT file
            replacedert.That(exportFile.Exists);
            exportFile.Delete();
        }

19 View Source File : PMProjectTests.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void CreateBlockFromBoundaryTest()
        {            
            _powerMILL.LoadProject(TestFiles.SimplePmProject1);            
            _powerMILL.ActiveProject.Boundaries.CreateBoundary(TestFiles.CurvesFiles);
            _powerMILL.ActiveProject.Refresh();
            PMBoundary boundary = _powerMILL.ActiveProject.Boundaries.ActiveItem;
            var boundingBox = _powerMILL.ActiveProject.CreateBlockFromBoundary(boundary);            
            replacedert.That(boundingBox.MaxZ, Is.EqualTo((Autodesk.Geometry.MM)53.353777));
            replacedert.That(boundingBox.MinZ, Is.EqualTo((Autodesk.Geometry.MM)(-30.004846)));
        }

19 View Source File : PMProjectTests.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void ExportBlockTest()
        {            
            _powerMILL.ActiveProject.Boundaries.CreateBoundary(TestFiles.CurvesFiles);
            _powerMILL.ActiveProject.Refresh();
            PMBoundary boundary = _powerMILL.ActiveProject.Boundaries.ActiveItem;
            var boundingBox = _powerMILL.ActiveProject.CreateBlockFromBoundaryWithLimits(boundary, 0, 100);            
            FileSystem.File file = FileSystem.File.CreateTemporaryFile("dmt", false);
            _powerMILL.ActiveProject.ExportBlock(file);
            replacedert.That(file.Exists);
            file.Delete();            
            file = FileSystem.File.CreateTemporaryFile("stl", false);
            _powerMILL.ActiveProject.ExportBlock(file);
            replacedert.That(file.Exists);
            file.Delete();
        }

19 View Source File : PMProjectTests.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void CreateCylinderBlockTest()
        {
            _powerMILL.ActiveProject.CreateCylinderBlock(new Point(-2, -5, -1), 11, 3, 15);
            var bounds = _powerMILL.ActiveProject.GetBlockLimits();
            replacedert.That(bounds, Is.EqualTo(new BoundingBox(-7.5, 3.5, -10.5, 0.5, -1, 14)));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void StartPointSetCoordinatesTest()
        {
            var rand = new Random();
            var toolpath = _powerMill.ActiveProject.Toolpaths.CreateAdaptiveAreaClearanceToolpath();
            var x = rand.NextDouble();
            var y = rand.NextDouble();
            var z = rand.NextDouble();

            toolpath.SetStartPointMethod(StartPointMethod.Absolute, x, y, z);

            replacedert.That(toolpath.StartPointMethod, Is.EqualTo(StartPointMethod.Absolute));
            replacedert.That(toolpath.StartPointPositionX, Is.EqualTo(x).Within(TOLERANCE));
            replacedert.That(toolpath.StartPointPositionY, Is.EqualTo(y).Within(TOLERANCE));
            replacedert.That(toolpath.StartPointPositionZ, Is.EqualTo(z).Within(TOLERANCE));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void StartPointSetCoordinatesPointTest()
        {
            var rand = new Random();
            var toolpath = _powerMill.ActiveProject.Toolpaths.CreateAdaptiveAreaClearanceToolpath();
            var point = new Point(rand.NextDouble(), rand.NextDouble(), rand.NextDouble());

            toolpath.SetStartPointMethod(StartPointMethod.Absolute, point);

            replacedert.That(toolpath.StartPointMethod, Is.EqualTo(StartPointMethod.Absolute));
            replacedert.That(toolpath.StartPointPositionX, Is.EqualTo(point.X.Value).Within(TOLERANCE));
            replacedert.That(toolpath.StartPointPositionY, Is.EqualTo(point.Y.Value).Within(TOLERANCE));
            replacedert.That(toolpath.StartPointPositionZ, Is.EqualTo(point.Z.Value).Within(TOLERANCE));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void StartPointSetCoordinatesPointWhileToolPathIsCalculatedTest()
        {
            var rand = new Random();
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var toolpath = _powerMill.ActiveProject.Toolpaths.First();
            var point = new Point(rand.NextDouble(), rand.NextDouble(), rand.NextDouble());

            toolpath.SetStartPointMethod(StartPointMethod.Absolute, point);

            replacedert.That(toolpath.StartPointMethod, Is.EqualTo(StartPointMethod.Absolute));
            replacedert.That(toolpath.StartPointPositionX, Is.EqualTo(point.X.Value).Within(TOLERANCE));
            replacedert.That(toolpath.StartPointPositionY, Is.EqualTo(point.Y.Value).Within(TOLERANCE));
            replacedert.That(toolpath.StartPointPositionZ, Is.EqualTo(point.Z.Value).Within(TOLERANCE));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EndPointSetCoordinatesTest()
        {
            var rand = new Random();
            var toolpath = _powerMill.ActiveProject.Toolpaths.CreateAdaptiveAreaClearanceToolpath();
            var x = rand.NextDouble();
            var y = rand.NextDouble();
            var z = rand.NextDouble();

            toolpath.SetEndPointMethod(EndPointMethod.Absolute, x, y, z);

            replacedert.That(toolpath.EndPointMethod, Is.EqualTo(EndPointMethod.Absolute));
            replacedert.That(toolpath.EndPointPositionX, Is.EqualTo(x).Within(TOLERANCE));
            replacedert.That(toolpath.EndPointPositionY, Is.EqualTo(y).Within(TOLERANCE));
            replacedert.That(toolpath.EndPointPositionZ, Is.EqualTo(z).Within(TOLERANCE));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EndPointSetCoordinatesPointTest()
        {
            var rand = new Random();
            var toolpath = _powerMill.ActiveProject.Toolpaths.CreateAdaptiveAreaClearanceToolpath();
            var point = new Point(rand.NextDouble(), rand.NextDouble(), rand.NextDouble());

            toolpath.SetEndPointMethod(EndPointMethod.Absolute, point);

            replacedert.That(toolpath.EndPointMethod, Is.EqualTo(EndPointMethod.Absolute));
            replacedert.That(toolpath.EndPointPositionX, Is.EqualTo(point.X.Value).Within(TOLERANCE));
            replacedert.That(toolpath.EndPointPositionY, Is.EqualTo(point.Y.Value).Within(TOLERANCE));
            replacedert.That(toolpath.EndPointPositionZ, Is.EqualTo(point.Z.Value).Within(TOLERANCE));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void EndPointSetCoordinatesPointWhileToolPathIsCalculatedTest()
        {
            var rand = new Random();
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var toolpath = _powerMill.ActiveProject.Toolpaths.First();
            var point = new Point(rand.NextDouble(), rand.NextDouble(), rand.NextDouble());

            toolpath.SetEndPointMethod(EndPointMethod.Absolute, point);

            replacedert.That(toolpath.EndPointMethod, Is.EqualTo(EndPointMethod.Absolute));
            replacedert.That(toolpath.EndPointPositionX, Is.EqualTo(point.X.Value).Within(TOLERANCE));
            replacedert.That(toolpath.EndPointPositionY, Is.EqualTo(point.Y.Value).Within(TOLERANCE));
            replacedert.That(toolpath.EndPointPositionZ, Is.EqualTo(point.Z.Value).Within(TOLERANCE));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void ConnectionTest()
        {
            // this test would be better if it was split into many small tests,
            // but it isn't testing doing any logic, it test concatenating the right strings
            var rand = new Random();
            var angle = rand.NextDouble();
            var distance = rand.Next();

            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var connections = _powerMill.ActiveProject.Toolpaths.First().Connections;
            connections.AddLeadsAtToolAxisDiscontinuities = true;
            connections.AllowStartPointToBeMoved = true;
            connections.AngularThreshold = angle;
            connections.ApproachDistance = distance;
            connections.ArcFitRadius = angle;
            connections.ArcFitRapidMove = true;
            connections.AutomaticallyExtend = true;
            connections.MaxMoveExtension = distance;
            connections.OverlapDistance = distance;
            connections.RetractDistance = distance;
            connections.GougeCheck = true;

            replacedert.That(connections.AddLeadsAtToolAxisDiscontinuities, Is.True, "AddLeadsAtToolAxisDiscontinuities not been set");
            replacedert.That(connections.AllowStartPointToBeMoved, Is.True, "AllowStartPointToBeMoved not been set");
            replacedert.That(connections.AngularThreshold.Value, Is.EqualTo(angle).Within(TOLERANCE), "AngularThreshold not been set");
            replacedert.That(connections.ApproachDistance.Value,
                        Is.EqualTo(distance).Within(TOLERANCE),
                        "ApproachDistance not been set");
            replacedert.That(connections.ArcFitRadius.Value, Is.EqualTo(angle).Within(TOLERANCE), "ArcFitRadius not been set");
            replacedert.That(connections.ArcFitRapidMove, Is.True, "ArcFitRapidMove not been set");
            replacedert.That(connections.AutomaticallyExtend, Is.True, "AutomaticallyExtend not been set");
            replacedert.That(connections.MaxMoveExtension.Value,
                        Is.EqualTo(distance).Within(TOLERANCE),
                        "MaxMoveExtension not been set");
            replacedert.That(connections.OverlapDistance.Value,
                        Is.EqualTo(distance).Within(TOLERANCE),
                        "OverlapDistance not been set");
            replacedert.That(connections.RetractDistance.Value,
                        Is.EqualTo(distance).Within(TOLERANCE),
                        "RetractDistance not been set");
            replacedert.That(connections.GougeCheck, Is.True, "GougeCheck not been set");
        }

19 View Source File : PMLevelOrSetsCollectionTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void AddSetTest()
        {
            var itemName = "Tesreplacedem";
            var set = _powerMill.ActiveProject.LevelsAndSets.CreateSet(itemName);

            replacedert.That(set, Is.Not.Null);
            replacedert.That(set.Name, Is.EqualTo(itemName));
            replacedert.That(set.Exists, Is.True);
        }

19 View Source File : PMLevelOrSetsCollectionTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void GetNewEnreplacedyNameTest()
        {
            //No enreplacedy exists, should return "1" and "NewName"
            replacedert.That(_powerMill.ActiveProject.LevelsAndSets.GetNewEnreplacedyName(), Is.EqualTo("1"));
            replacedert.That(_powerMill.ActiveProject.LevelsAndSets.GetNewEnreplacedyName("NewName"), Is.EqualTo("NewName"));

            //Create a new enreplacedy
            var level = _powerMill.ActiveProject.LevelsAndSets.CreateLevel("1");

            //1 enreplacedy exists, should return "2"
            replacedert.That(_powerMill.ActiveProject.LevelsAndSets.GetNewEnreplacedyName(), Is.EqualTo("2"));

            //Rename the enreplacedy
            level.Name = "MyPrefix";

            //1 enreplacedy called "MyPrefix" exists, should return "NewName" and "MyPrefix_1"
            replacedert.That(_powerMill.ActiveProject.LevelsAndSets.GetNewEnreplacedyName("NewName"), Is.EqualTo("NewName"));
            replacedert.That(_powerMill.ActiveProject.LevelsAndSets.GetNewEnreplacedyName("MyPrefix"), Is.EqualTo("MyPrefix_1"));

            //Delete the enreplacedy
            _powerMill.ActiveProject.LevelsAndSets.Remove(level);
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void ConnectionForPowerMill2016Test()
        {
            if (_powerMill.Version.Major > PMEnreplacedy.POWER_MILL_2016.Major)
            {
                Console.WriteLine(@"AddLeadsToShortLinks and ShortLinksToLongLinkThreshold is not support in 2017");
                return;
            }
            var distance = new Random().Next();
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var connections = _powerMill.ActiveProject.Toolpaths.First().Connections;

            connections.AddLeadsToShortLinks = true;
            connections.ShortLinkToLongLinkThreshold = distance;

            replacedert.That(connections.AddLeadsToShortLinks, Is.True, "AddLeadsToShortLinks not been set");
            replacedert.That(connections.ShortLinkToLongLinkThreshold.Value,
                        Is.EqualTo(distance).Within(TOLERANCE),
                        "ShortLinkToLongLinkThreshold not been set");
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void ConnectionForPowerMill2017Test()
        {
            if (_powerMill.Version.Major < PMEnreplacedy.POWER_MILL_2017.Major)
            {
                Console.WriteLine(@"Link1st to Link5th is not support in 2016");
                return;
            }
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var connections = _powerMill.ActiveProject.Toolpaths.First().Connections;
            foreach (var linkType in Enum.GetValues(typeof(LinkTypes)).Cast<LinkTypes>())
            {
                connections.Link1st = linkType;
                connections.Link2nd = linkType;
                connections.Link3rd = linkType;
                connections.Link4th = linkType;
                connections.Link5th = linkType;

                replacedert.That(connections.Link1st, Is.EqualTo(linkType), "Link1st not been set");
                replacedert.That(connections.Link2nd, Is.EqualTo(linkType), "Link2nd not been set");
                replacedert.That(connections.Link3rd, Is.EqualTo(linkType), "Link3rd not been set");
                replacedert.That(connections.Link4th, Is.EqualTo(linkType), "Link4th not been set");
                replacedert.That(connections.Link5th, Is.EqualTo(linkType), "Link5th not been set");
            }
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void RetractMoveTypesTest()
        {
            _powerMill.LoadProject(TestFiles.BasicToolpath);
            var connections = _powerMill.ActiveProject.Toolpaths.First().Connections;
            foreach (var moveType in typeof(MoveDirection).GetEnumValues())
            {
                connections.RetractAndApproachMoves = (MoveDirection) moveType;
                replacedert.That(connections.RetractAndApproachMoves, Is.EqualTo(moveType), "RetractAndApproachMoves not been set");
            }
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void ToolpathPointOrientationVectorTest()
        {
            _powerMill.LoadProject(TestFiles.SimplePmProject1);
            replacedert.That(_powerMill.ActiveProject.Toolpaths[0].ToolpathPointOrientationVector(0, 0), Is.EqualTo(new Vector()));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void NumberOfLinksTest()
        {
            _powerMill.LoadProject(TestFiles.SimplePmProject1);
            replacedert.That(_powerMill.ActiveProject.Toolpaths[0].NumberOfLinks, Is.EqualTo(100));
        }

19 View Source File : PMToolpathTest.cs
License : MIT License
Project Creator : Autodesk

[Test]
        public void LeadAndLinkRapidTimeTest()
        {
            _powerMill.LoadProject(TestFiles.SimplePmProject1);
            replacedert.That(_powerMill.ActiveProject.Toolpaths[0].LeadsAndLinksRapidTime, Is.EqualTo(TimeSpan.Parse("00:09:23.7610000")));
        }

See More Examples