public void TestFindClosestInOnePoint()
        {
            Point point = new Point(100, 100);

            FindPairResult result = PointsDistances.FindClosestPair(new[] { point });

            Assert.That(result.Point1, Is.EqualTo(point));
            Assert.That(result.Point2, Is.EqualTo(point));
            Assert.That(result.Distance, Is.EqualTo(0.0));
        }
        public void TestFindClosestInTenPoints()
        {
            List <Point> points = Enumerable.Range(0, 10)
                                  .Select(a => new Point(a * a, a * a))
                                  .ToList();
            var expectedResult = new [] { points[0], points[1] };

            FindPairResult result = PointsDistances.FindClosestPair(points);

            CollectionAssert.AreEquivalent(expectedResult, new[] { result.Point1, result.Point2 });
        }
        public void TestFindClosestInTwoPoints()
        {
            Point point1 = new Point(10, 0);
            Point point2 = new Point(20, 0);

            FindPairResult result = PointsDistances.FindClosestPair(new[] { point1, point2 });

            Assert.That(result.Point1, Is.EqualTo(point1));
            Assert.That(result.Point2, Is.EqualTo(point2));
            Assert.That(result.Distance, Is.EqualTo(10.0));
        }
 public void TestFindClosestInEmptyList()
 {
     PointsDistances.FindClosestPair(new Point[0]);
 }
 public void TestFindClosestInNullList()
 {
     PointsDistances.FindClosestPair(null);
 }