Пример #1
0
        public void AdvanceToUtility_UtilityOwned_ShouldMovePlayerToWaterWorksAndPayRent()
        {
            Board            board     = new CardBoard();
            AdvanceToUtility advToUtil = new AdvanceToUtility();

            advToUtil.BoardReference = board;
            Player horse = new Player("Horse");
            Player car   = new Player("Car");

            car.Bank = 2000;
            board.AddPlayerToBoard(car, 0);
            board.AddPlayerToBoard(horse, 0);

            board.Move(car, 8);

            horse.LastRoll = (6, 6);
            advToUtil.Execute(horse);

            Assert.True((horse.Bank > -120) && (horse.Bank <= -20));
            Assert.Equal(8, horse.Position);
        }
Пример #2
0
        public void Birthday_WithTwoOtherPlayers_ShouldCollect20Dollars()
        {
            Monopoly game     = new Monopoly(null, null, null);
            Board    board    = new CardBoard();
            Birthday birthday = new Birthday();
            Player   horse    = new Player("Horse");
            Player   car      = new Player("Car");
            Player   shoe     = new Player("Shoe");

            game.AddPlayer(horse);
            game.AddPlayer(car);
            game.AddPlayer(shoe);
            board.AddPlayerToBoard(car, 0);
            board.AddPlayerToBoard(horse, 0);
            board.AddPlayerToBoard(shoe, 0);

            birthday.Execute(horse);

            Assert.Equal(20, horse.Bank);
            Assert.Equal(-10, car.Bank);
            Assert.Equal(-10, shoe.Bank);
        }
Пример #3
0
        public void AdvanceToRailroad_AllRailroadsOwned_ShouldPayDoubleRentToOwner()
        {
            Board             board   = new CardBoard();
            AdvanceToRailroad advToRr = new AdvanceToRailroad();

            advToRr.BoardReference = board;
            Player horse = new Player("Horse");
            Player car   = new Player("Car");

            car.Bank = 2000;
            board.AddPlayerToBoard(car, 0);
            board.AddPlayerToBoard(horse, 0);

            board.Move(car, 4);
            board.Move(car, 1);
            board.Move(car, 1);
            board.Move(car, 1);

            advToRr.Execute(horse);

            Assert.Equal(-400, horse.Bank);
            Assert.Equal(4, horse.Position);
        }
Пример #4
0
        public void GoBack3Spaces_WhenOnSomeRandomSpace_ShouldMove3SpacesBack()
        {
            Board         board = new CardBoard();
            GoBack3Spaces back  = new GoBack3Spaces();
            Player        horse = new Player("Horse");

            horse.Bank = 175;
            board.AddPlayerToBoard(horse, 5);

            back.Execute(horse);

            Assert.Equal(158, horse.Bank);
            Assert.Equal(2, horse.Position);
        }
Пример #5
0
        public void AdvanceToReading_ReadingUnowned_ShouldMovePlayerToReadingRailroadAndPurchase()
        {
            Board            board     = new CardBoard();
            AdvanceToReading advToRead = new AdvanceToReading();

            advToRead.BoardReference = board;
            Player horse = new Player("Horse");

            horse.Bank = 500;
            board.AddPlayerToBoard(horse, 0);

            advToRead.Execute(horse);

            Assert.Equal(300, horse.Bank);
            Assert.Equal(4, horse.Position);
        }
Пример #6
0
        public void AdvanceToUtility_UtilityUnowned_ShouldMovePlayerToWaterWorksAndPurchase()
        {
            Board            board     = new CardBoard();
            AdvanceToUtility advToUtil = new AdvanceToUtility();

            advToUtil.BoardReference = board;
            Player horse = new Player("Horse");

            horse.Bank = 500;
            board.AddPlayerToBoard(horse, 0);

            advToUtil.Execute(horse);

            Assert.Equal(350, horse.Bank);
            Assert.Equal(8, horse.Position);
        }
Пример #7
0
        public void StreetRepairs_WithTwoHouses_ShouldPay80Dollars()
        {
            Board         board   = new CardBoard();
            StreetRepairs repairs = new StreetRepairs();
            Player        horse   = new Player("Horse");

            horse.Bank = 220;
            board.AddPlayerToBoard(horse, 0);

            board.Move(horse, 10);
            board.Move(horse, 1);
            horse.Build();

            repairs.Execute(horse);

            Assert.Equal(-80, horse.Bank);
        }