public void TestMoveOn_Without_Board() { Ball ball = new Ball(2, 2); ball.MoveAt(1, 1); Assert.AreEqual(2, ball.CPoint.X); Assert.AreEqual(2, ball.CPoint.Y); }
public Game(int mapWidth, int mapHeight, int roadWidth, int roadHeigth, Point startPoint) { this._ball = new Ball(startPoint); this.GameMap = new GameMap(mapWidth, mapHeight, roadWidth, roadHeigth, startPoint, _ball); this.TotalScore = 0; this._status = GameStatus.ReadyToStart; }
public void TestMoveOn_With_Board() { Ball ball = new Ball(1, 2); GameMap board = new GameMap(80, 10, 1, 1, new Point(40, 0), ball); ball.MoveAt(4, 4); Assert.AreEqual(4, ball.CPoint.X); Assert.AreEqual(4, ball.CPoint.Y); }
public void TestAddGameObject_Player() { GameMap map = new GameMap(80, 20, 1, 1, new Point(40, 0), new Ball(40, 0)); IGameObject ball = new Ball(1, 1); map.AddGameObject(ball); IGameObject lastGameObject = map.GameObjects.Last(); Assert.AreSame(lastGameObject, ball); Assert.AreSame(map, ball.Map); }
public void TestConstructors() { Ball ball = new Ball(1, 2); Assert.AreEqual(1, ball.CPoint.X); Assert.AreEqual(2, ball.CPoint.Y); Assert.IsNull(ball.Map); ball = new Ball(new Point(3, 4)); Assert.AreEqual(3, ball.CPoint.X); Assert.AreEqual(4, ball.CPoint.Y); Assert.IsNull(ball.Map); }
public void TestCanBeMovedOn_With_Board() { Ball ball = new Ball(1, 2); GameMap map = new GameMap(80, 20, 1, 1, new Point(40, 0), ball); Assert.IsFalse(ball.CanBeMoveAt(-1, -1)); Assert.IsTrue(ball.CanBeMoveAt(1, 3)); Assert.IsTrue(ball.CanBeMoveAt(8, 4)); Assert.IsFalse(ball.CanBeMoveAt(-1, -2)); Assert.IsFalse(ball.CanBeMoveAt(9, -1)); Assert.IsFalse(ball.CanBeMoveAt(-2, -1)); Assert.IsTrue(ball.CanBeMoveAt(0, 5)); Assert.IsFalse(ball.CanBeMoveAt(0, -3)); }
public GameMap(int width, int height, int roadWidth, int roadHeight, Point startPoint, Ball ball) { #region Validation if (width <= 0) { throw new ArgumentException("'width' cannot be <= 0"); } if (height <= 0) { throw new ArgumentException("'height' cannot be <= 0"); } if (roadWidth <= 0) { throw new ArgumentException("'road width' cannot be <= 0"); } if (roadHeight <= 0) { throw new ArgumentException("'road width' cannot be <= 0"); } #endregion this.Width = width; this.Height = height; this.RoadWidth = roadWidth; this.RoadHeight = roadHeight; this.Ball = ball; this.Ball.Map = this; this._capacity = 1000; this._map = new List<MapHolder>(_capacity); this.GenerateMap(startPoint); }
public void TestMoveOn_With_Board_WrongY() { Ball ball = new Ball(1, 2); GameMap board = new GameMap(80, 20, 1, 1, new Point(40, 0), ball); ball.MoveAt(2, -3); }
public void TestConstructorException() { Ball ball = new Ball(-1, -2); }
public void TestCanBeMovedOn_Without_Map() { Ball ball = new Ball(1, 2); Assert.IsFalse(ball.CanBeMoveAt(2, 2)); }
public void TestAddGameObject_Player_Wrong_Position() { GameMap map = new GameMap(80, 20, 1, 1, new Point(40, 0), new Ball(40, 0)); IGameObject ball = new Ball(90, 1); map.AddGameObject(ball); }