Ejemplo n.º 1
0
 public void _09_ShouldMoveDownAndRightWithoutHittingBorder()
 {
     BeetleHelper.SetRightProperty(_beetleObject, true);
     BeetleHelper.SetUpProperty(_beetleObject, false);
     AssertAndInvokeChangePositionMethod(_beetleObject);
     // verify the beetle went in up and right direction
     AssertPropertyValue(_beetleObject, BeetleHelper.XProperty, _beetleX + 1);
     AssertPropertyValue(_beetleObject, BeetleHelper.YProperty, _beetleY + 1);
     AssertEllipsePosition(_beetleX + 1, _beetleY + 1);
 }
Ejemplo n.º 2
0
 public void _13_ShouldTurnRightWhenHittingLeftSideOfCanvas()
 {
     _beetleX = (_beetleSize / 2) + 1; // 1 pixel from left side
     BeetleHelper.SetXProperty(_beetleObject, _beetleX);
     BeetleHelper.SetRightProperty(_beetleObject, false);
     BeetleHelper.SetUpProperty(_beetleObject, false);
     AssertAndInvokeChangePositionMethod(_beetleObject);
     AssertPropertyValue(_beetleObject, BeetleHelper.XProperty, _beetleX - 1); // should go left
     AssertPropertyValue(_beetleObject, BeetleHelper.YProperty, _beetleY + 1); // should go down
     AssertPropertyValue(_beetleObject, BeetleHelper.RightProperty, true);
     AssertPropertyValue(_beetleObject, BeetleHelper.UpProperty, false);
 }
Ejemplo n.º 3
0
 public void _12_ShouldTurnLeftWhenHittingRightSideOfCanvas()
 {
     _beetleX = TestCanvasWidth - (_beetleSize / 2) - 1; // 1 pixel from right side
     BeetleHelper.SetXProperty(_beetleObject, _beetleX);
     BeetleHelper.SetRightProperty(_beetleObject, true);
     BeetleHelper.SetUpProperty(_beetleObject, false);
     AssertAndInvokeChangePositionMethod(_beetleObject);
     AssertPropertyValue(_beetleObject, BeetleHelper.XProperty, _beetleX + 1); // should go right
     AssertPropertyValue(_beetleObject, BeetleHelper.YProperty, _beetleY + 1); // should go down
     AssertPropertyValue(_beetleObject, BeetleHelper.RightProperty, false);
     AssertPropertyValue(_beetleObject, BeetleHelper.UpProperty, false);
 }
Ejemplo n.º 4
0
 public void _11_ShouldTurnUpWhenHittingLowerBoundOfCanvas()
 {
     _beetleY = TestCanvasHeight - (_beetleSize / 2) - 1; // 1 pixel from bottom of canvas
     BeetleHelper.SetYProperty(_beetleObject, _beetleY);
     BeetleHelper.SetRightProperty(_beetleObject, true);
     BeetleHelper.SetUpProperty(_beetleObject, false);
     AssertAndInvokeChangePositionMethod(_beetleObject);
     AssertPropertyValue(_beetleObject, BeetleHelper.XProperty, _beetleX + 1); // should go right
     AssertPropertyValue(_beetleObject, BeetleHelper.YProperty, _beetleY + 1); // should go down
     AssertPropertyValue(_beetleObject, BeetleHelper.UpProperty, true);        // should turn
     AssertPropertyValue(_beetleObject, BeetleHelper.RightProperty, true);
 }
Ejemplo n.º 5
0
 public void _10_ShouldTurnDownWhenHittingUpperBoundOfCanvas()
 {
     _beetleY = _beetleSize / 2 + 1; // 1 pixel from top of canvas
     BeetleHelper.SetYProperty(_beetleObject, _beetleY);
     BeetleHelper.SetRightProperty(_beetleObject, true);
     BeetleHelper.SetUpProperty(_beetleObject, true);
     AssertAndInvokeChangePositionMethod(_beetleObject);
     AssertPropertyValue(_beetleObject, BeetleHelper.XProperty, _beetleX + 1); // should go right
     AssertPropertyValue(_beetleObject, BeetleHelper.YProperty, _beetleY - 1); // should go up
     AssertPropertyValue(_beetleObject, BeetleHelper.UpProperty, false);       // should turn
     AssertPropertyValue(_beetleObject, BeetleHelper.RightProperty, true);
 }