Example #1
0
        public void Should_return_the_closest_intersection_to_the_center(string path1, string path2, int expectedDistance)
        {
            var wire = new Wire(path1);

            Assert.That(wire.DoesIntersect(path2), Is.EqualTo(true), "Wires do not cross");
            Assert.That(wire.ClosestIntersect(path2), Is.EqualTo(expectedDistance));
        }
Example #2
0
        public void Should_report_if_intersects_a_point(string path, string test, bool expectIntersect)
        {
            var wire   = new Wire(path);
            var points = test.Split(',').Select(s => int.TryParse(s, out var number) ? number : 0).ToArray();

            Assert.That(wire.DoesIntersect(points[0], points[1]), Is.EqualTo(expectIntersect));
        }
Example #3
0
        public void Should_report_if_intersects_a_path(string wirePath, string testPath, bool expectIntersect)
        {
            var wire = new Wire(wirePath);

            Assert.That(wire.DoesIntersect(testPath), Is.EqualTo(expectIntersect));
        }