public void IsSurfaceLineIntersectionWithReferenceLineInSection_SurfaceLineNull_ReturnsFalse() { // Setup var calculation = new TestPipingCalculation(); // Call bool intersects = calculation.IsSurfaceLineIntersectionWithReferenceLineInSection(Enumerable.Empty <Segment2D>()); // Assert Assert.IsFalse(intersects); }
private static PipingCalculation <PipingInput> CreateRandomCalculation() { var calculation = new TestPipingCalculation { Name = "Random name", Comments = { Body = "Random body" } }; PipingTestDataGenerator.SetRandomDataToPipingInput(calculation.InputParameters); return(calculation); }
public void Constructor_DefaultPropertyValuesAreSet() { // Call var calculation = new TestPipingCalculation(); // Assert Assert.IsInstanceOf <IPipingCalculation <PipingInput> >(calculation); Assert.IsInstanceOf <CloneableObservable>(calculation); Assert.AreEqual("Nieuwe berekening", calculation.Name); Assert.IsInstanceOf <PipingInput>(calculation.InputParameters); Assert.IsNull(calculation.Comments.Body); }
public void IsSurfaceLineIntersectionWithReferenceLineInSection_SurfaceLineIntersectsReferenceLine_ReturnsTrue() { // Setup var surfaceLine = new PipingSurfaceLine(string.Empty) { ReferenceLineIntersectionWorldPoint = new Point2D(0.0, 0.0) }; surfaceLine.SetGeometry(new[] { new Point3D(0.0, 5.0, 0.0), new Point3D(0.0, 0.0, 1.0), new Point3D(0.0, -5.0, 0.0) }); var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { new Point2D(0.0, 0.0), new Point2D(10.0, 0.0) }); var calculation = new TestPipingCalculation { InputParameters = { SurfaceLine = surfaceLine } }; IEnumerable <Segment2D> lineSegments = Math2D.ConvertPointsToLineSegments(referenceLine.Points); // Call bool intersects = calculation.IsSurfaceLineIntersectionWithReferenceLineInSection(lineSegments); // Assert Assert.IsTrue(intersects); }
public void IsSurfaceLineIntersectionWithReferenceLineInSection_EmptySegmentCollection_ThrowsInvalidOperationException() { // Setup var surfaceLine = new PipingSurfaceLine(string.Empty) { ReferenceLineIntersectionWorldPoint = new Point2D(0.0, 0.0) }; surfaceLine.SetGeometry(new[] { new Point3D(0.0, 5.0, 0.0), new Point3D(0.0, 0.0, 1.0), new Point3D(0.0, -5.0, 0.0) }); var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] { new Point2D(0.0, 0.0), new Point2D(10.0, 0.0) }); var calculation = new TestPipingCalculation { InputParameters = { SurfaceLine = surfaceLine } }; // Call void Call() => calculation.IsSurfaceLineIntersectionWithReferenceLineInSection(Enumerable.Empty <Segment2D>()); // Assert Assert.Throws <InvalidOperationException>(Call); }