AdventOfCode/AdventOfCode.Tests/2d-shapes/PointTests.cs
2023-12-10 14:42:35 +01:00

52 lines
1.2 KiB
C#

using AdventOfCode.Core.Shared.Grid;
using NUnit.Framework;
namespace AdventOfCode.Tests._2d_shapes
{
[TestFixture]
public class PointTests
{
[Test]
public void PointDoIntersectPoint()
{
Point one = new Point(0,0), two = new Point(0,0);
bool doesIntersect = one.Intersect(two);
Assert.That(doesIntersect, Is.True);
}
[Test]
public void PointDoNotIntersectPoint()
{
Point one = new Point(0, 0), two = new Point(0, 1);
bool doesIntersect = one.Intersect(two);
Assert.That(doesIntersect, Is.False);
}
[Test]
public void LineDoesIntersectPoint()
{
Point one = new Point(3, 1);
Line two = new Line(new Point(1, 1), 5);
bool doesIntersect = two.Intersect(one);
Assert.That(doesIntersect, Is.True);
}
[Test]
public void LineDoNotIntersectPoint()
{
Point one = new Point(3, 1);
Line two = new Line(new Point(1, 2), 5);
bool doesIntersect = two.Intersect(one);
Assert.That(doesIntersect, Is.False);
}
}
}