47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using AdventOfCode.Core.Shared.Grid;
|
|
|
|
namespace AdventOfCode.Tests._2d_shapes
|
|
{
|
|
[TestFixture]
|
|
public class RectangleTests
|
|
{
|
|
private Rectangle TestRectangle;
|
|
|
|
[SetUp]
|
|
public void SetupLine()
|
|
{
|
|
TestRectangle = new Rectangle(new Point(1,1), new Point(6,3));
|
|
}
|
|
|
|
[Test]
|
|
public void PointDoesIntersectRectangle()
|
|
{
|
|
Point testPoint = new Point(1,1);
|
|
|
|
bool intersects = TestRectangle.Intersect(testPoint);
|
|
|
|
Assert.That(intersects, Is.True);
|
|
}
|
|
|
|
[Test]
|
|
public void PointDoesIntersectOnLineRectangle()
|
|
{
|
|
Point testPoint = new Point(3, 1);
|
|
|
|
bool intersects = TestRectangle.Intersect(testPoint);
|
|
|
|
Assert.That(intersects, Is.True);
|
|
}
|
|
|
|
[Test]
|
|
public void PointDoesIntersectInRectangle()
|
|
{
|
|
Point testPoint = new Point(3, 3);
|
|
|
|
bool intersects = TestRectangle.Intersect(testPoint);
|
|
|
|
Assert.That(intersects, Is.True);
|
|
}
|
|
}
|
|
}
|