Added more shape tests
This commit is contained in:
parent
efc3fa3b1b
commit
8576e28af6
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user