public void When_MultiplePointsAreGenerated_BestPointIsReturned() { var testCoordinate = new Coordinate(0, 0); var tolerance = 0.05; var checker = new SnapPointCandidateChecker(testCoordinate, tolerance); var bestPoint = new Coordinate(tolerance / 4.0, 0); var secondBestPoint = new Coordinate(tolerance / 3.0, 0); var thirdBestPoint = new Coordinate(tolerance / 2.0, 0); checker.ContainsBetterCandidate((c) => new[] { bestPoint, secondBestPoint, thirdBestPoint }); Assert.AreEqual(bestPoint, checker.BestSnapPoint); }
public void When_MultiplePointsAreGenerated_OnlyPointsWithinToleranceAreUsed() { var testCoordinate = new Coordinate(0, 0); var tolerance = 0.05; var checker = new SnapPointCandidateChecker(testCoordinate, tolerance); var bestPoint = new Coordinate(tolerance * 1.1, 0); var secondBestPoint = new Coordinate(tolerance * 1.2, 0); var thirdBestPoint = new Coordinate(tolerance * 1.3, 0); checker.ContainsBetterCandidate((c) => new[] { bestPoint, secondBestPoint, thirdBestPoint }); Assert.AreNotEqual(bestPoint, checker.BestSnapPoint); Assert.AreNotEqual(secondBestPoint, checker.BestSnapPoint); Assert.AreNotEqual(thirdBestPoint, checker.BestSnapPoint); }