Added more shape tests

This commit is contained in:
Rob 2023-12-10 22:11:25 +01:00
parent efc3fa3b1b
commit 8576e28af6

View File

@ -1,12 +1,46 @@
using System; using AdventOfCode.Core.Shared.Grid;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdventOfCode.Tests._2d_shapes namespace AdventOfCode.Tests._2d_shapes
{ {
internal class RectangleTests [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);
}
} }
} }