Exemplo n.º 1
0
        public void TestBoard()
        {
            CellFactory factory = new CircularClosedCellFactory();

            //string input = "E,E,J,H,E,T,J,T,E,E,H,J,T,H,E,E,J,H,E,T,J,T,E,E,H,J,T,H,J,E,E,J,H,E,T,J,T,E,E,H,J,T,E,H,E";
            //string outComes = "4,4,4,6,7,8,5,11,10,12,2,3,5,6,7,8,5,11,10,12,2,3,5,6,7,8,5,11,10,12";

            string input    = "E,E,J,H,E,T,J";
            string outComes = "1,1,2,1,2,3";
            Board  board    = new Board(factory, input);

            Dice dice = new Dice(outComes);

            GameRules gameRule = new GameRules
            {
                MaxMovesPerPlayer  = 3,
                MinimumPlayerCount = 2
            };
            MonopolyGame game = new MonopolyGame(board, dice, gameRule);

            Player p1 = new Player(1, 1000, board.StartCell);
            Player p2 = new Player(2, 1000, board.StartCell);

            game.AddPlayer(p1);
            game.AddPlayer(p2);

            string outCome = game.StartGame();

            Assert.IsTrue(board.GetCurrentCellIndex(p1.CurrentCell) == 6);
            Assert.IsTrue(board.GetCurrentCellIndex(p2.CurrentCell) == 6);

            Assert.IsTrue(p1.GetTotalWorth() == 1200);
            Assert.IsTrue(p2.GetTotalWorth() == 1050);
        }
Exemplo n.º 2
0
        public void TestCellCount()
        {
            CellFactory factory = new CircularClosedCellFactory();
            string      input   = "E,E,J,H,E,T,J";

            string[] cellInput = input.Split(',');
            Board    board     = new Board(factory, input);

            Assert.IsTrue(board.TotalCells() == cellInput.Length);
        }
Exemplo n.º 3
0
        public void HopCellTest()
        {
            CellFactory factory = new CircularClosedCellFactory();
            string      input   = "E,E,J,H,E,T,J";
            Board       board   = new Board(factory, input);

            Cell   cell = board.StartCell;
            Player p1   = new Player(1, 1000, cell);

            p1.HopCell(7);
            Assert.IsTrue(board.GetCurrentCellIndex(p1.CurrentCell) == 1);

            p1.HopCell(3);
            Assert.IsTrue(board.GetCurrentCellIndex(p1.CurrentCell) == 4);
        }
Exemplo n.º 4
0
        public void GetCurrentCellIndex()
        {
            CellFactory factory = new CircularClosedCellFactory();
            string      input   = "E,E,J,H,E,T,J";

            string[] cellInput = input.Split(',');
            Board    board     = new Board(factory, input);

            Player p1   = new Player(1, 1000, board.StartCell);
            Cell   cell = p1.HopCell(3);

            Assert.IsTrue(board.GetCurrentCellIndex(cell) == 4);

            Cell badCell = new EmptyCell();

            Assert.IsTrue(board.GetCurrentCellIndex(badCell) == -1);
        }