NavisworksTransport/UnitTests/CoordinateSystem/GroundPathObjectLiftOffsetTests.cs

43 lines
1.4 KiB
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using NavisworksTransport.Core.Animation;
using NavisworksTransport.Utils.CoordinateSystem;
using System.Numerics;
namespace NavisworksTransport.UnitTests.CoordinateSystem
{
[TestClass]
public class GroundPathObjectLiftOffsetTests
{
[TestMethod]
public void YUp_GroundPathLift_ShouldOffsetAlongHostY()
{
Vector3 offset = PathAnimationManager.ResolveGroundPathObjectLiftOffsetVector(1.25, CoordinateSystemType.YUp);
AssertVector(offset, 0.0, 1.25, 0.0);
}
[TestMethod]
public void ZUp_GroundPathLift_ShouldOffsetAlongHostZ()
{
Vector3 offset = PathAnimationManager.ResolveGroundPathObjectLiftOffsetVector(1.25, CoordinateSystemType.ZUp);
AssertVector(offset, 0.0, 0.0, 1.25);
}
[TestMethod]
public void GroundPathLift_ShouldReturnZero_WhenLiftIsNotPositive()
{
Vector3 offset = PathAnimationManager.ResolveGroundPathObjectLiftOffsetVector(0.0, CoordinateSystemType.ZUp);
AssertVector(offset, 0.0, 0.0, 0.0);
}
private static void AssertVector(Vector3 actual, double x, double y, double z, double tolerance = 1e-6)
{
Assert.AreEqual(x, actual.X, tolerance);
Assert.AreEqual(y, actual.Y, tolerance);
Assert.AreEqual(z, actual.Z, tolerance);
}
}
}