public void GetZAtL_SurfaceLineVerticalAtL_ThrowsMechanismSurfaceLineException() { // Setup double testZ = new Random(22).NextDouble(); var surfaceLine = new TestMechanismSurfaceLine(); var l = (RoundedDouble)2.0; surfaceLine.SetGeometry(new[] { new Point3D(0.0, 0.0, 2.2), new Point3D(l, 0.0, testZ), new Point3D(l, 0.0, testZ + 1), new Point3D(3.0, 0.0, 7.7) }); // Call TestDelegate test = () => surfaceLine.GetZAtL(l); // Assert var exception = Assert.Throws <MechanismSurfaceLineException>(test); string message = $"Kan geen hoogte bepalen op het punt met de lokale coördinaat {l}, omdat de profielschematisatie verticaal loopt op dat punt."; Assert.AreEqual(message, exception.Message); }
public void GetZAtL_GeometryIsEmpty_ThrowsInvalidOperationException() { // Setup var surfaceLine = new TestMechanismSurfaceLine(); var l = (RoundedDouble) new Random(21).NextDouble(); // Call TestDelegate test = () => surfaceLine.GetZAtL(l); // Assert string exceptionMessage = Assert.Throws <InvalidOperationException>(test).Message; Assert.AreEqual("De profielschematisatie heeft geen geometrie.", exceptionMessage); }
public void GetZAtL_SurfaceLineContainsPointAtL_ReturnsZOfPoint() { // Setup double testZ = new Random(22).NextDouble(); var surfaceLine = new TestMechanismSurfaceLine(); var l = (RoundedDouble)2.0; surfaceLine.SetGeometry(new[] { new Point3D(0.0, 0.0, 2.2), new Point3D(l, 0.0, testZ), new Point3D(3.0, 0.0, 7.7) }); // Call double result = surfaceLine.GetZAtL(l); // Assert Assert.AreEqual(testZ, result, 1e-2); }
public void GetZAtL_SurfaceLineDoesNotContainsPointAtL_ThrowsArgumentOutOfRangeException(double l) { // Setup double testZ = new Random(22).NextDouble(); var surfaceLine = new TestMechanismSurfaceLine(); surfaceLine.SetGeometry(new[] { new Point3D(1.0, 0.0, 2.2), new Point3D(2.0, 0.0, testZ), new Point3D(4.1, 0.0, 7.7) }); // Call TestDelegate test = () => surfaceLine.GetZAtL((RoundedDouble)l); // Assert const string expectedMessage = "Kan geen hoogte bepalen. De lokale coördinaat moet in het bereik [0,0, 3,1] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(test, expectedMessage); }