Exemplo n.º 1
0
        public void SuccessTest_2()
        {
            var gameConfig = new GameConfig
            {
                BoardSize = new BoardSize {
                    Columns = 3, Rows = 3
                },
                StartingPoint = new StartingPoint {
                    Direction = Direction.North, X = 0, Y = 2
                },
                ExitPoint = new Position {
                    X = 2, Y = 2
                },
                Mines = new List <Position>()
                {
                    new Position {
                        X = 1, Y = 1
                    }
                }
            };

            configMock.Setup(config => config.GetGameConfig(It.IsAny <string>())).Returns(gameConfig);
            var moves = new List <Sequence>()
            {
                new Sequence {
                    Moves = new List <GameActions>()
                    {
                        GameActions.Move, GameActions.Move, GameActions.Rotate,
                        GameActions.Move, GameActions.Move, GameActions.Rotate, GameActions.Move, GameActions.Move
                    }
                }
            };

            var game   = new Game.Game();
            var turtle = new Turtle();

            game.DrawBoard(gameConfig);

            GameResult result = GameResult.Start;

            foreach (var sequence in moves)
            {
                game.InitializePlayer(turtle, gameConfig.StartingPoint);
                result = game.Play(sequence.Moves);
            }

            Assert.AreEqual(GameResult.Sucess, result);
        }