SnakeGameTests SnakeEatsChunk Method Delta Engine Documentation

Namespace: Snake.Tests
Assembly: Snake.Tests (in Snake.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void SnakeEatsChunk()
Examples

[Test, CloseAfterFirstFrame]
public void SnakeEatsChunk()
{
    var game = new Game(Resolve<Window>());
    game.StartGame();
    var snakeHead = game.Snake.Get<Body>().BodyParts[0].DrawArea;
    var direction = game.Snake.Get<Body>().Direction;
    var originalLength = game.Snake.Get<Body>().BodyParts.Count;
    game.Chunk.DrawArea =
        new Rectangle(new Vector2D(snakeHead.Left + direction.X, snakeHead.Top + direction.Y),
            new Size(blockSize));
    game.MoveUp();
    AdvanceTimeAndUpdateEntities(moveSpeed);
    Assert.AreEqual(originalLength + 1, game.Snake.Get<Body>().BodyParts.Count);
}
See Also