@@ -60,19 +60,20 @@ public void CircleFromThreePointsArgumentException()
6060 Assert . Throws < ArgumentException > ( ( ) => { Circle2D . FromPoints ( p1 , p2 , p3 ) ; } ) ;
6161 }
6262
63- [ TestCase ( "0,0" , 1 , "-10,+10" , "+10,+10" , 0 ) ]
64- [ TestCase ( "0,0" , 1 , "-10,+1" , "+10,+1" , 1 ) ]
65- [ TestCase ( "0,0" , 1 , "-10,0" , "+10,0" , 2 ) ]
66- [ TestCase ( "0,0" , 1 , "-10,-1" , "+10,-1" , 1 ) ]
67- [ TestCase ( "0,0" , 1 , "-10,-10" , "+10,-10" , 0 ) ]
68- public void CircleIntersectWithLine2D_NumberOfIntersections ( string sc , double radius , string sps , string spe , int expectedNumberOfIntersections )
63+ [ TestCase ( "0,0" , 1 , "-10,+10" , "+10,+10" , "empty" ) ]
64+ [ TestCase ( "0,0" , 1 , "-10,+1" , "+10,+1" , "0,+1" ) ]
65+ [ TestCase ( "0,0" , 1 , "-10,0" , "+10,0" , "-1,0;+1,0" ) ]
66+ [ TestCase ( "0,0" , 1 , "-10,-1" , "+10,-1" , "0,-1" ) ]
67+ [ TestCase ( "0,0" , 1 , "-10,-10" , "+10,-10" , "empty" ) ]
68+ public void CircleIntersectWithLine2D_NumberOfIntersections ( string sc , double radius , string sps , string spe , string expectedIntersectionsAsString )
6969 {
7070 var circle = new Circle2D ( Point2D . Parse ( sc ) , radius ) ;
7171 var line = new Line2D ( Point2D . Parse ( sps ) , Point2D . Parse ( spe ) ) ;
7272
7373 var actual = circle . IntersectWith ( line ) ;
7474
75- Assert . That ( actual . Count ( ) , Is . EqualTo ( expectedNumberOfIntersections ) ) ;
75+ var expected = parseToPointsArray ( expectedIntersectionsAsString ) ;
76+ CollectionAssert . AreEquivalent ( expected , actual ) ;
7677 //TODO: the intersection should be on the circle
7778 Assert . That ( actual . All ( p => Math . Abs ( circle . Center . DistanceTo ( p ) - circle . Radius ) < 1e-6 ) , Is . EqualTo ( true ) , "distance between center and intersection" ) ;
7879 //TODO: the intersection should be on the line
0 commit comments