Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Calculation/Math2DTest.cs =================================================================== diff -u -r2da86d14cee084c7d6bfa52136d387cdcdb0a025 -r3dfdbd9071b9b71d541cb5380004d8b43e3e8f25 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Calculation/Math2DTest.cs (.../Math2DTest.cs) (revision 2da86d14cee084c7d6bfa52136d387cdcdb0a025) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Calculation/Math2DTest.cs (.../Math2DTest.cs) (revision 3dfdbd9071b9b71d541cb5380004d8b43e3e8f25) @@ -1,6 +1,5 @@ using System; -using System.Collections.ObjectModel; -using System.Linq; +using System.Collections; using NUnit.Framework; using Ringtoets.Piping.Data; using Ringtoets.Piping.IO.Calculation; @@ -16,74 +15,87 @@ /// which represent the coordinate of a point. Each pair of coordinates form a segment. /// The last 2 double values are the expected intersection points. /// - private static readonly Point2D[][] IntersectingSegments = + private static IEnumerable IntersectingSegments() { // \/ // /\ - new [] + var testCaseDatadata1 = new TestCaseData(new[] { new Point2D(0.0,0.0), new Point2D(1.0,1.0), new Point2D(1.0,0.0), new Point2D(0.0,1.0), new Point2D(0.5,0.5) - }, + }, "IntersectingSegments 1"); + yield return testCaseDatadata1; + // __ // / // / - new[] + var testCaseDatadata2 = new TestCaseData(new[] { new Point2D(0.0,0.0), new Point2D(1.0,1.0), new Point2D(0.0,1.0), new Point2D(1.0,1.0), new Point2D(1.0,1.0) - }, + }, "IntersectingSegments 2"); + yield return testCaseDatadata2; + // // / // /__ - new[] + var testCaseDatadata3 = new TestCaseData(new[] { new Point2D(0.0,0.0), new Point2D(1.0,0.0), new Point2D(0.0,0.0), new Point2D(1.0,1.0), new Point2D(0.0,0.0) - } - }; + }, "IntersectingSegments 3"); + yield return testCaseDatadata3; + } /// /// Test cases for parallel segments. The contains pairs of , /// which represent the coordinate of a point. Each pair of coordinates form a segment. /// - private static readonly Point2D[][] ParallelSegments = + private static IEnumerable ParallelSegments() { + // __ // __ - new[] + var testCaseDatadata1 = new TestCaseData(new[] { - new Point2D(0.0,0.0), - new Point2D(1.0,0.0), - new Point2D(0.0,1.0), - new Point2D(1.0,1.0) - }, - // ____ (connected in single point) - new[] + new Point2D(0.0, 0.0), + new Point2D(1.0, 0.0), + new Point2D(0.0, 1.0), + new Point2D(1.0, 1.0) + }, "ParallelSegments"); + yield return testCaseDatadata1; + + + // ____ (connected in single point) + var testCaseDatadata2 = new TestCaseData(new[] { - new Point2D(0.0,0.0), - new Point2D(1.0,0.0), - new Point2D(1.0,0.0), - new Point2D(2.0,0.0) - }, + new Point2D(0.0, 0.0), + new Point2D(1.0, 0.0), + new Point2D(1.0, 0.0), + new Point2D(2.0, 0.0) + }, "ParallelSegments, connected in single point"); + yield return testCaseDatadata2; + + // __ (overlap) - new[] + var testCaseDatadata3 = new TestCaseData(new[] { - new Point2D(0.0,0.0), - new Point2D(1.0,0.0), - new Point2D(0.5,0.0), - new Point2D(1.5,0.0) - } - }; + new Point2D(0.0, 0.0), + new Point2D(1.0, 0.0), + new Point2D(0.5, 0.0), + new Point2D(1.5, 0.0) + }, "ParallelSegments, overlap"); + yield return testCaseDatadata3; + } /// /// Test cases for non intersecting segments. The contains pairs of , @@ -107,7 +119,7 @@ [Test] [TestCaseSource("IntersectingSegments")] - public void LineIntersectionWithLine_DifferentLineSegmentsWithIntersections_ReturnsPoint(Point2D[] points) + public void LineIntersectionWithLine_DifferentLineSegmentsWithIntersections_ReturnsPoint(Point2D[] points, string testname = "") { // Call var result = Math2D.LineIntersectionWithLine(points[0], points[1], points[2], points[3]); @@ -118,7 +130,8 @@ [Test] [TestCaseSource("ParallelSegments")] - public void LineIntersectionWithLine_DifferentParallelLineSegments_ReturnsNoPoint(Point2D[] points) + // String testname was added because the Teamcity report only counts the unique signatures that were tested + public void LineIntersectionWithLine_DifferentParallelLineSegments_ReturnsNoPoint(Point2D[] points, string testname="") { // Call var result = Math2D.LineIntersectionWithLine(points[0], points[1], points[2], points[3]);