Files
speckle-sharp-sdk/tests/Speckle.Objects.Tests.Unit/Geometry/BoxTests.cs
T
Claire Kuang 8a148b892f refactor(objects): removes unused classes and constructors (#151)
* removes unused classes and gh schema constructors

* additional cleanup of backwards compatibility (v2)

* Update Arc.cs

* updates unit tests

* re-adds bbox to box

* updates tests

* pr fixes for backwards compatibility

* Uses a new objects test in Revit for serialization tests

* format

* updates revit model curve class to inherit from curve geometry, and adds deprecated v2 classes

* fixes transform unit tests

* fixes deprecated speckle type

* removes unnecessary new revit curve classes

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
Co-authored-by: Alan Rynne <alan@rynne.es>
2024-11-04 17:05:16 +00:00

43 lines
975 B
C#

using NUnit.Framework;
using Speckle.Objects.Geometry;
using Speckle.Sdk.Common;
namespace Speckle.Objects.Tests.Unit.Geometry;
[TestFixture, TestOf(typeof(Box))]
public class BoxTests
{
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 CanCreateBox()
{
const string UNITS = Units.Meters;
var box = new Box()
{
plane = TestPlane,
xSize = new() { start = -1, end = 1 },
ySize = new() { start = -2, end = 2 },
zSize = new() { start = -3, end = 3 },
units = UNITS,
};
Assert.That(box.area, Is.EqualTo(2 * (2 * 4 + 2 * 6 + 4 * 6)).Within(0.0001));
Assert.That(box.volume, Is.EqualTo(2 * 4 * 6).Within(0.0001));
}
}