Files
speckle-sharp-sdk/tests/Speckle.Objects.Tests.Unit/Geometry/BoxTests.cs
T
Adam Hathcock 14d959834f Convert to Xunit (#196)
* xunit unit tests

* most pass with formatting

* convert objects to xunit

* remove nunit

* format

* merge fixes

* switch objects to fluent assertions

* update to fluent assertions

* more FA

* convert all to FA

* Format

* Fix tests

* formatting

* hopefully made credential test better

* Catch more specific exception

* use another more specific exception

* Fix tests

* update to xunit

* update packages
2025-01-09 15:32:28 +00:00

40 lines
927 B
C#

using FluentAssertions;
using Speckle.Objects.Geometry;
using Speckle.Sdk.Common;
using Xunit;
namespace Speckle.Objects.Tests.Unit.Geometry;
public class BoxTests
{
private Plane TestPlane =>
new()
{
origin = new Point(0, 0, 0, Units.Meters),
normal = new Vector(0, 0, 1, Units.Meters),
xdir = new Vector(1, 0, 0, Units.Meters),
ydir = new Vector(0, 1, 0, Units.Meters),
units = Units.Meters,
};
[Fact]
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 area
box.area.Should().BeApproximately(2 * (2 * 4 + 2 * 6 + 4 * 6), 0.0001);
// Assert volume
box.volume.Should().BeApproximately(2 * 4 * 6, 0.0001);
}
}