Files
speckle-sharp-sdk/tests/Speckle.Objects.Tests.Unit/Geometry/ArcTests.cs
T
Jedd Morgan ccb4f54550 Jedd/cxpla 55 add required keyword for more geometry types (#101)
* Sdk

* Objects

* Supressed IDE warnings via editor config instead of nowarn

* Nullability and other warnings

* using

* Required keyword on lines and meshes

* Fixed test project

* fixed tests

* Proxies

* Fixed equality of Point

* IEquatable

* Fixed issue with serialization of detached lists

* Added tests for jsonIgnore affecting id calc

* removed comments

* Fixed issue with fallback to double on large values

* Fixed undocumented large number support
2024-09-13 14:47:29 +01:00

39 lines
1.0 KiB
C#

using NUnit.Framework;
using Speckle.Objects.Geometry;
using Speckle.Sdk.Common;
namespace Speckle.Objects.Tests.Unit.Geometry;
[TestFixture, TestOf(typeof(Arc))]
public class ArcTests
{
private Plane TestPlane
{
get
{
const string UNITS = Units.Meters;
return new()
{
origin = new Point(0, 0, 0, UNITS),
normal = new Vector(0, 0, 1, UNITS),
xdir = new Vector(1, 0, 0, UNITS),
ydir = new Vector(0, 1, 0, UNITS),
units = UNITS,
};
}
}
[Test]
public void CanCreateArc_HalfCircle()
{
const string UNITS = Units.Meters;
var arc = new Arc(TestPlane, new Point(-5, 5, 0, UNITS), new Point(5, 5, 0, UNITS), Math.PI);
Assert.That(arc.startAngle, Is.EqualTo(0));
Assert.That(arc.endAngle, Is.EqualTo(Math.PI));
Assert.That(Point.Distance(arc.midPoint, new Point(0, 0, 0, UNITS)), Is.EqualTo(0).Within(0.0001));
Assert.That(Point.Distance(arc.plane.origin, new Point(0, 5, 0, UNITS)), Is.EqualTo(0).Within(0.0001));
}
}