示例#1
0
        public void MoveConfigrationTest()
        {
            IMoveConfiguration moveConfiguration = new MoveConfiguration(new List <string>()
            {
                "M R L", "L M R", "R M L"
            });

            Assert.AreEqual(moveConfiguration.GetMoves()[0][0], Business.Enums.MoveType.Forward);
            Assert.AreEqual(moveConfiguration.GetMoves()[0][1], Business.Enums.MoveType.Right);
            Assert.AreEqual(moveConfiguration.GetMoves()[0][2], Business.Enums.MoveType.Left);

            Assert.AreEqual(moveConfiguration.GetMoves()[1][0], Business.Enums.MoveType.Left);
            Assert.AreEqual(moveConfiguration.GetMoves()[1][1], Business.Enums.MoveType.Forward);
            Assert.AreEqual(moveConfiguration.GetMoves()[1][2], Business.Enums.MoveType.Right);

            Assert.AreEqual(moveConfiguration.GetMoves()[2][0], Business.Enums.MoveType.Right);
            Assert.AreEqual(moveConfiguration.GetMoves()[2][1], Business.Enums.MoveType.Forward);
            Assert.AreEqual(moveConfiguration.GetMoves()[2][2], Business.Enums.MoveType.Left);
        }
示例#2
0
        public void StartIsNotOnBoard()
        {
            IBoardConfiguration boardConfiguration = new BoardConfiguration("5 4");
            IExitConfiguration  exitConfiguration  = new ExitConfiguration("4 2");
            IMinesConfiguration minesConfiguration = new MinesConfiguration("1,1 1,3 3,3");
            IMoveConfiguration  moveConfiguration  = new MoveConfiguration(new List <string>()
            {
                "M R L", "L M R", "R M L"
            });
            IStartConfiguration startConfiguration = new StartConfiguration("6 9 N");

            IBoard                  board  = boardConfiguration.GetBoard();
            List <ICoordinate>      mines  = minesConfiguration.GetMines();
            ICoordinate             exit   = exitConfiguration.GetExitPoint();
            IPosition               start  = startConfiguration.GetStartPoint();
            List <List <MoveType> > moves  = moveConfiguration.GetMoves();
            ITurtle                 turtle = new Turtle(start);

            IGameValidator gameValidator = new GameValidator(board, mines, exit, start, moves, turtle);

            gameValidator.Validate();
        }