-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
1 parent
465f635
commit 14d9598
Showing
91 changed files
with
2,684 additions
and
2,211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using Xunit; | ||
|
||
[assembly: CollectionBehavior(DisableTestParallelization = true)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,78 @@ | ||
using NUnit.Framework; | ||
using FluentAssertions; | ||
using Speckle.Objects.Geometry; | ||
using Speckle.Sdk.Common; | ||
using Xunit; | ||
|
||
namespace Speckle.Objects.Tests.Unit.Geometry; | ||
|
||
[TestFixture, TestOf(typeof(Arc))] | ||
public class ArcTests | ||
{ | ||
private Plane TestPlaneCounterClockwise | ||
{ | ||
get | ||
private Plane TestPlaneCounterClockwise => | ||
new() | ||
{ | ||
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, | ||
}; | ||
} | ||
} | ||
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, | ||
}; | ||
|
||
private Plane TestPlaneClockwise | ||
{ | ||
get | ||
private Plane TestPlaneClockwise => | ||
new() | ||
{ | ||
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, | ||
}; | ||
} | ||
} | ||
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, | ||
}; | ||
|
||
[Test] | ||
[Fact] | ||
public void CanCreateArc_HalfCircle_CounterClockwise() | ||
{ | ||
const string UNITS = Units.Meters; | ||
var counterClockwiseArc = new Arc() | ||
{ | ||
plane = TestPlaneCounterClockwise, | ||
startPoint = new Point(1, 0, 0, UNITS), | ||
endPoint = new Point(-1, 0, 0, UNITS), | ||
midPoint = new Point(0, 1, 0, UNITS), | ||
units = UNITS, | ||
startPoint = new Point(1, 0, 0, Units.Meters), | ||
endPoint = new Point(-1, 0, 0, Units.Meters), | ||
midPoint = new Point(0, 1, 0, Units.Meters), | ||
units = Units.Meters, | ||
}; | ||
|
||
Assert.That(Point.Distance(counterClockwiseArc.midPoint, new Point(0, 1, 0, UNITS)), Is.EqualTo(0).Within(0.0001)); | ||
Assert.That( | ||
Point.Distance(counterClockwiseArc.plane.origin, new Point(0, 0, 0, UNITS)), | ||
Is.EqualTo(0).Within(0.0001) | ||
); | ||
Assert.That(counterClockwiseArc.measure - Math.PI, Is.EqualTo(0).Within(0.0001)); | ||
Assert.That(counterClockwiseArc.radius, Is.EqualTo(1).Within(0.0001)); | ||
Assert.That(counterClockwiseArc.length, Is.EqualTo(Math.PI).Within(0.0001)); | ||
Point.Distance(counterClockwiseArc.midPoint, new Point(0, 1, 0, Units.Meters)).Should().BeApproximately(0, 0.0001); | ||
|
||
Point | ||
.Distance(counterClockwiseArc.plane.origin, new Point(0, 0, 0, Units.Meters)) | ||
.Should() | ||
.BeApproximately(0, 0.0001); | ||
|
||
(counterClockwiseArc.measure - Math.PI).Should().BeApproximately(0, 0.0001); | ||
|
||
counterClockwiseArc.radius.Should().BeApproximately(1, 0.0001); | ||
|
||
counterClockwiseArc.length.Should().BeApproximately(Math.PI, 0.0001); | ||
} | ||
|
||
[Test] | ||
[Fact] | ||
public void CanCreateArc_HalfCircle_Clockwise() | ||
{ | ||
const string UNITS = Units.Meters; | ||
var counterClockwiseArc = new Arc() | ||
var clockwiseArc = new Arc() | ||
{ | ||
plane = TestPlaneClockwise, | ||
endPoint = new Point(1, 0, 0, UNITS), | ||
startPoint = new Point(-1, 0, 0, UNITS), | ||
midPoint = new Point(0, 1, 0, UNITS), | ||
units = UNITS, | ||
endPoint = new Point(1, 0, 0, Units.Meters), | ||
startPoint = new Point(-1, 0, 0, Units.Meters), | ||
midPoint = new Point(0, 1, 0, Units.Meters), | ||
units = Units.Meters, | ||
}; | ||
|
||
Assert.That(Point.Distance(counterClockwiseArc.midPoint, new Point(0, 1, 0, UNITS)), Is.EqualTo(0).Within(0.0001)); | ||
Assert.That( | ||
Point.Distance(counterClockwiseArc.plane.origin, new Point(0, 0, 0, UNITS)), | ||
Is.EqualTo(0).Within(0.0001) | ||
); | ||
Assert.That(counterClockwiseArc.measure - Math.PI, Is.EqualTo(0).Within(0.0001)); | ||
Assert.That(counterClockwiseArc.radius, Is.EqualTo(1).Within(0.0001)); | ||
Assert.That(counterClockwiseArc.length, Is.EqualTo(Math.PI).Within(0.0001)); | ||
Point.Distance(clockwiseArc.midPoint, new Point(0, 1, 0, Units.Meters)).Should().BeApproximately(0, 0.0001); | ||
|
||
Point.Distance(clockwiseArc.plane.origin, new Point(0, 0, 0, Units.Meters)).Should().BeApproximately(0, 0.0001); | ||
|
||
(clockwiseArc.measure - Math.PI).Should().BeApproximately(0, 0.0001); | ||
|
||
clockwiseArc.radius.Should().BeApproximately(1, 0.0001); | ||
|
||
clockwiseArc.length.Should().BeApproximately(Math.PI, 0.0001); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.