Esempio n. 1
0
 public void IfThisIsNaNShouldNotThrowOverlap()
 {
     var area1 = new Area(new Point(10, 10), new Point(20, 20));
     var area2 = new Area(new Point(double.NaN, 20), new Point(25, 25));
     ProximityTestResult result = area2.OverlapsWith(area1);
     Assert.AreEqual(Proximity.NotOverlapping, result.Proximity);
 }
Esempio n. 2
0
 public void NullShouldThrowOverlap()
 {
     Area area1 = null;
     var area2 = new Area(new Point(11, 20), new Point(25, 25));
     area2.OverlapsWith(area1);
     Assert.Fail();
 }
Esempio n. 3
0
 public void NaNShouldThrowOverlap()
 {
     var area1 = new Area(new Point(double.NaN, 10), new Point(20, 20));
     var area2 = new Area(new Point(11, 20), new Point(25, 25));
     area2.OverlapsWith(area1);
 }
Esempio n. 4
0
 public void ShouldOverlap()
 {
     var area1 = new Area(new Point(10, 10), new Point(20, 20));
     var area2 = new Area(new Point(15, 15), new Point(25, 25));
     Assert.AreEqual(Proximity.Overlapping, area2.OverlapsWith(area1).Proximity);
 }
Esempio n. 5
0
 public void ShouldNotOverlapAndBeUp()
 {
     var area1 = new Area(new Point(20, 0), new Point(25, 5));
     var area2 = new Area(new Point(20, 45.1), new Point(25, 65.1));
     ProximityTestResult result = area2.OverlapsWith(area1);
     result.Proximity.Should().Be(Proximity.VeryClose);
 }
Esempio n. 6
0
 public void ShouldNotOverlapAndBeToTheRight()
 {
     var area1 = new Area(new Point(10, 20), new Point(15, 25));
     var area2 = new Area(new Point(55, 20), new Point(60, 25));
     ProximityTestResult result = area1.OverlapsWith(area2);
     result.Proximity.Should().Be(Proximity.VeryClose);
 }
Esempio n. 7
0
 public void ShouldBeVeryCloseTouching()
 {
     var area1 = new Area(new Point(10, 10), new Point(20, 20));
     var area2 = new Area(new Point(10, 20), new Point(25, 25));
     Assert.AreEqual(Proximity.VeryClose, area2.OverlapsWith(area1).Proximity);
 }
Esempio n. 8
0
 public void ShouldBeVeryCloseAndBeUp()
 {
     var area1 = new Area(new Point(0, 0), new Point(5, 5));
     var area2 = new Area(new Point(0, 10), new Point(5, 15));
     ProximityTestResult result = area2.OverlapsWith(area1);
     Assert.AreEqual(Direction.Up, result.DirectionToOtherObject);
     Assert.AreEqual(Proximity.VeryClose, result.Proximity);
 }
Esempio n. 9
0
 public void ShouldBeVeryCloseAndBeToTheRight()
 {
     var area1 = new Area(new Point(10, 20), new Point(15, 25));
     var area2 = new Area(new Point(20, 20), new Point(25, 25));
     ProximityTestResult result = area1.OverlapsWith(area2);
     Assert.AreEqual(Direction.Right, result.DirectionToOtherObject);
     Assert.AreEqual(Proximity.VeryClose, result.Proximity);
 }