public void TestEdgesAndMovement() { Block TestBlock = new Block_Line(Color.Blue, 20, 10, 20, 4, 1); TestBlock.Rotate = false; TestBlock.Assign(); TestBlock.AssignEdges(); int x = 20 * (TestBlock.Size - 1); TestBlock.MoveRight(x); TestBlock.MoveRight(x); TestBlock.MoveRight(x); TestBlock.AssignEdges(); foreach (Point2D lte in TestBlock.TopLeftEdges) { Assert.AreEqual(20 + 20 * 3, lte.X); Assert.AreEqual(10, lte.Y); } TestBlock.MoveDown(x); TestBlock.MoveDown(x); TestBlock.AssignEdges(); foreach (Point2D rbe in TestBlock.BottomRightEdges) { Assert.AreEqual(20 + 20 * TestBlock.Size + 20 * 3, rbe.X); Assert.AreEqual(10 + TestBlock.Length + 20 * 2, rbe.Y); } }
public void TestBottomEdgeAssign() { Block TestBlock = new Block_Line(Color.Blue, 20, 10, 20, 4, 1); TestBlock.Rotate = false; TestBlock.Assign(); TestBlock.AssignEdges(); foreach (Point2D rbe in TestBlock.BottomRightEdges) { Assert.AreEqual(20 + 20 * TestBlock.Size, rbe.X); Assert.AreEqual(10 + TestBlock.Length, rbe.Y); } foreach (Point2D lbe in TestBlock.BottomLeftEdges) { Assert.AreEqual(20, lbe.X); Assert.AreEqual(10 + TestBlock.Length, lbe.Y); } //test after Rotation TestBlock.Rotate = true; TestBlock.AssignEdges(); foreach (Point2D rbe in TestBlock.BottomRightEdges) { Assert.AreEqual(20 + TestBlock.Length, rbe.X); Assert.AreEqual(10 + 20 * TestBlock.Size, rbe.Y); } foreach (Point2D lbe in TestBlock.BottomLeftEdges) { Assert.AreEqual(20, lbe.X); Assert.AreEqual(10 + 20 * TestBlock.Size, lbe.Y); } }