Ejemplo n.º 1
0
        public void MoveDownTest()
        {
            // arrange
            const int expected     = 1;
            var       snakeElement = new SnakeElement(1, 0, DirectionOfMove.Down);

            // act
            snakeElement.Move();

            // assert
            Assert.AreEqual(expected, snakeElement.DistanceFromTop);
        }
Ejemplo n.º 2
0
        public void MoveLeftTest()
        {
            // arrange
            const int expected     = 0;
            var       snakeElement = new SnakeElement(1, 1, DirectionOfMove.Left);

            // act
            snakeElement.Move();

            // assert
            Assert.AreEqual(expected, snakeElement.DistanceFromLeft);
        }
Ejemplo n.º 3
0
        public void ChangeDirectionToUpValidConditionsTest()
        {
            // arrange
            const DirectionOfMove expected = DirectionOfMove.Up;
            var snakeElement = new SnakeElement(1, 1, DirectionOfMove.Right);

            // act
            snakeElement.ChangeDirection(expected);
            snakeElement.Move();

            // assert
            Assert.AreEqual(expected, snakeElement.DirectionOfMove);
        }
Ejemplo n.º 4
0
        public void ChangeDirectionToDownWhenCurrentIsUpTest()
        {
            // arrange
            const DirectionOfMove expected = DirectionOfMove.Up;
            var snakeElement = new SnakeElement(1, 1, DirectionOfMove.Up);

            // act
            snakeElement.ChangeDirection(DirectionOfMove.Down);
            snakeElement.Move();

            // assert
            Assert.AreEqual(expected, snakeElement.DirectionOfMove);
        }
Ejemplo n.º 5
0
        public void ChangeDirectionToLeftWhenCurrentIsRightTest()
        {
            // arrange
            const DirectionOfMove expected = DirectionOfMove.Right;
            var snakeElement = new SnakeElement(1, 1, DirectionOfMove.Right);

            // act
            snakeElement.ChangeDirection(DirectionOfMove.Left);
            snakeElement.Move();

            // assert
            Assert.AreEqual(expected, snakeElement.DirectionOfMove);
        }
Ejemplo n.º 6
0
        public void ChangeDirectionToDownValidConditionsTest()
        {
            // arrange
            const DirectionOfMove expected = DirectionOfMove.Down;
            var snakeElement = new SnakeElement(0, 0, DirectionOfMove.Left);

            // act
            snakeElement.ChangeDirection(expected);
            snakeElement.Move();

            // assert
            Assert.AreEqual(expected, snakeElement.DirectionOfMove);
        }