示例#1
0
 public JailTests()
 {
     player = new Player("Name", 1500);
     player.BuyingStrategy = new NeverBuyStrategy();
     goToJail = new GoToJail(ClassicBoard.GoToJailLocation, ClassicBoard.JailLocation);
     dice     = new FakeDice();
     turn     = new Turn(dice, player, new ClassicBoard());
 }
示例#2
0
        public void LandOnGoToJailPutsPlayerInJail()
        {
            var someProperty = new GoToJail(30, "Go To Jail", 10);

            someProperty.Land(playerCar);

            Assert.AreEqual(10, playerCar.Location);
        }
示例#3
0
        public void SetUp()
        {
            playerId = 0;
            var faker = new MotherFaker();

            banker     = faker.Banker;
            jailRoster = faker.JailRoster;
            gameBoard  = faker.GameBoard;
            goToJail   = new GoToJail(30, "Go To Jail", 10, banker, jailRoster, gameBoard);
        }
示例#4
0
        public void PlayerPassesOverGoToJail_BalanceIsUnchangedAndLocation()
        {
            var cashBeforeGo = banker.GetPlayerBalance(playerCar);
            var goToJail     = new GoToJail(30, "Go To Jail", 10);

            playerCar.Location = 29;

            goToJail.Visit(playerCar);

            Assert.AreEqual(30, playerCar.Location);
            Assert.AreEqual(0, banker.GetPlayerBalance(playerCar) - cashBeforeGo);
        }
示例#5
0
        public void PlayerLandsOnGoToJailEndsUpVisitingJail()
        {
            var banker   = new Banker();
            var dice     = new Dice();
            var board    = new Board(banker, dice);
            var goToJail = new GoToJail(30, "Go To Jail", 10);

            var turnHandler  = new TurnHandler(board, banker, dice);
            var roundHandler = new RoundHandler(turnHandler);
            var game         = new Game(banker, roundHandler);
            var player       = game.CreatePlayerAccount("Car");

            goToJail.Land(player);

            Assert.AreEqual(10, player.Location);
        }
示例#6
0
 public static Space[] GetDefaultBoard(GameState gameState)
 {
     Space[] board = new Space[40];
     board[0]  = new NoEffectSpace(gameState, "Start");
     board[1]  = new Regular(gameState, "Mediterranean Avenue", 60, Colours.Brown, 2, 10, 30, 90, 160, 250);
     board[2]  = new Lottery(gameState, "Community Chest", TypeOfLottery.CommunityChest);
     board[3]  = new Regular(gameState, "Baltic Avenue", 60, Colours.Brown, 4, 20, 60, 180, 320, 450);
     board[4]  = new Tax(gameState, "Income Tax", TypeOfTax.IncomeTax, 100);
     board[5]  = new Railway(gameState, "Reading Railroad", 200);
     board[6]  = new Regular(gameState, "Oriental Avenue", 100, Colours.LightBlue, 6, 30, 90, 270, 400, 550);
     board[7]  = new Lottery(gameState, "Chance", TypeOfLottery.Chance);
     board[8]  = new Regular(gameState, "Vermont Avenue", 100, Colours.LightBlue, 6, 30, 90, 270, 400, 550);
     board[9]  = new Regular(gameState, "Connecticut Avenue", 120, Colours.LightBlue, 8, 40, 100, 300, 450, 600);
     board[10] = new NoEffectSpace(gameState, "Jail");
     board[11] = new Regular(gameState, "St. Charles Place", 140, Colours.Purple, 10, 50, 150, 450, 625, 750);
     board[12] = new Utility(gameState, "Electric Company", 150);
     board[13] = new Regular(gameState, "States Avenue", 140, Colours.Purple, 10, 50, 150, 450, 625, 750);
     board[14] = new Regular(gameState, "Virginia Avenue", 160, Colours.Purple, 12, 60, 180, 500, 700, 900);
     board[15] = new Railway(gameState, "Pennsylvanla Railroad", 200);
     board[16] = new Regular(gameState, "St. James Place", 180, Colours.Orange, 14, 70, 200, 550, 750, 950);
     board[17] = new Lottery(gameState, "Community Chest", TypeOfLottery.CommunityChest);
     board[18] = new Regular(gameState, "Tennessee Avenue", 180, Colours.Orange, 14, 70, 200, 550, 750, 950);
     board[19] = new Regular(gameState, "New York Avenue", 200, Colours.Orange, 16, 80, 220, 600, 800, 1000);
     board[20] = new NoEffectSpace(gameState, "Free Parking");
     board[21] = new Regular(gameState, "Kentucky Avenue", 220, Colours.Red, 18, 90, 250, 700, 875, 1050);
     board[22] = new Lottery(gameState, "Chance", TypeOfLottery.Chance);
     board[23] = new Regular(gameState, "Indiana Avenue", 220, Colours.Red, 18, 90, 250, 700, 875, 1050);
     board[24] = new Regular(gameState, "Illinois Avenue", 240, Colours.Red, 20, 100, 300, 750, 925, 1100);
     board[25] = new Railway(gameState, "B. & O. Railroad", 200);
     board[26] = new Regular(gameState, "Atlantic Avenue", 260, Colours.Yellow, 22, 110, 330, 800, 975, 1150);
     board[27] = new Regular(gameState, "Ventnor Avenue", 260, Colours.Yellow, 22, 110, 330, 800, 975, 1150);
     board[28] = new Utility(gameState, "Water Work", 150);
     board[29] = new Regular(gameState, "Marvin Gardens", 280, Colours.Yellow, 24, 120, 360, 850, 1025, 1200);
     board[30] = new GoToJail(gameState, "Go To Jail");
     board[31] = new Regular(gameState, "Pacific Avenue", 300, Colours.Green, 26, 130, 390, 900, 1100, 1275);
     board[32] = new Regular(gameState, "North Carolina Avenue", 300, Colours.Green, 26, 130, 390, 900, 1100, 1275);
     board[33] = new Lottery(gameState, "Community Chest", TypeOfLottery.CommunityChest);
     board[34] = new Regular(gameState, "North Carolina Avenue", 320, Colours.Green, 28, 150, 450, 1000, 1200, 1400);
     board[35] = new Railway(gameState, "Short Line", 200);
     board[36] = new Lottery(gameState, "Chance", TypeOfLottery.Chance);
     board[37] = new Regular(gameState, "Park Place", 350, Colours.DarkBlue, 35, 175, 500, 1100, 1300, 1500);
     board[38] = new Tax(gameState, "Luxury Tax", TypeOfTax.LuxuryTax, 100);
     board[39] = new Regular(gameState, "BoardWork", 400, Colours.DarkBlue, 50, 200, 600, 1400, 1700, 2000);
     return(board);
 }
        protected override void CreateBoardComponents()
        {
            var go = new Go(GoLocation, GoSalaryBonus);
            var mediterraneanAvenue  = new Property(MediterraneanAvenueLocation, MediterraneanAvenuePrice, MediterraneanAvenueRent);
            var communityChestOne    = new CommunityChest(CommunityChestOneLocation);
            var balticAvenue         = new Property(BalticAvenueLocation, BalticAvenuePrice, BalticAvenueRent);
            var incomeTax            = new IncomeTax(IncomeTaxLocation, IncomeTaxPercentage, MaximumIncomeTaxPaymentAmount);
            var readingRailrod       = new Property(ReadingRailroadLocation, RailroadPrice, BaseRailroadRent);
            var orientalAvenue       = new Property(OrientalAvenueLocation, OrientalAvenuePrice, OrientalAvenueRent);
            var chanceOne            = new Chance(ChanceOneLocation);
            var vermontAvenue        = new Property(VermontAvenueLocation, VermontAvenuePrice, VermontAvenueRent);
            var connecticutAvenue    = new Property(ConnecticutAvenueLocation, ConnecticutAvenuePrice, ConnecticutAvenueRent);
            var justVisiting         = new Location(JustVisitingLocation);
            var stCharlesPlace       = new Property(StCharlesPlaceLocation, StCharlesPlacePrice, StCharlesPlaceRent);
            var electricCompany      = new Property(ElectricCompanyLocation, UtilityPrice, 0);
            var statesAvenue         = new Property(StatesAvenueLocation, StatesAvenuePrice, StatesAvenueRent);
            var virginiaAvenue       = new Property(VirginiaAvenueLocation, VirginiaAvenuePrice, VirginiaAvenueRent);
            var pennsylvaniaRailroad = new Property(PennsylvaniaRailroadLocation, RailroadPrice, BaseRailroadRent);
            var stJamesPlace         = new Property(StJamesPlaceLocation, StJamesPlacePrice, StJamesPlaceRent);
            var communityChestTwo    = new CommunityChest(CommunityChestTwoLocation);
            var tennesseeAvenue      = new Property(TennesseeAvenueLocation, TennesseeAvenuePrice, TennesseeAvenueRent);
            var newYorkAvenue        = new Property(NewYorkAvenueLocation, NewYorkAvenuePrice, NewYorkAvenueRent);
            var freeParking          = new Location(FreeParkingLocation);
            var kentuckyAvenue       = new Property(KentuckyAvenueLocation, KentuckyAvenuePrice, KentuckyAvenueRent);
            var chanceTwo            = new Chance(ChanceTwoLocation);
            var indianaAvenue        = new Property(IndianaAvenueLocation, IndianaAvenuePrice, IndianaAvenueRent);
            var illinoisAvenue       = new Property(IllinoisAvenueLocation, IllinoisAvenuePrice, IllinoisAvenueRent);
            var boRailroad           = new Property(BORailroadLocation, RailroadPrice, BaseRailroadRent);
            var atlanticAvenue       = new Property(AtlanticAvenueLocation, AtlanticAvenuePrice, AtlanticAvenueRent);
            var ventnorAvenue        = new Property(VentnorAvenueLocation, VentnorAvenuePrice, VentnorAvenueRent);
            var waterWorks           = new Property(WaterWorksLocation, UtilityPrice, 0);
            var marvinGardens        = new Property(MarvinGardensLocation, MarvinGardensPrice, MarvinGardensRent);
            var goToJail             = new GoToJail(GoToJailLocation, JustVisitingLocation);
            var pacificAvenue        = new Property(PacificAvenueLocation, PacificAvenuePrice, PacificAvenueRent);
            var northCarolinaAvenue  = new Property(NorthCarolinaAvenueLocation, NorthCarolinaAvenuePrice, NorthCarolinaAvenueRent);
            var communityChestThree  = new CommunityChest(CommunityChestThreeLocation);
            var pennsylvaniaAvenue   = new Property(PennsylvaniaAvenueLocation, PennsylvaniaAvenuePrice, PennsylvaniaAvenueRent);
            var shortLine            = new Property(ShortLineLocation, RailroadPrice, BaseRailroadRent);
            var chanceThree          = new Chance(ChanceThreeLocation);
            var parkPlace            = new Property(ParkPlaceLocation, ParkPlacePrice, ParkPlaceRent);
            var luxuryTax            = new LuxuryTax(LuxuryTaxLocation, LuxuryTaxPaymentAmount);
            var boardwalk            = new Property(BoardwalkLocation, BoardwalkPrice, BoardwalkRent);

            var classicPropertyRentStrategy = new ClassicPropertyRentStrategy();

            var purpleGroup    = new PropertyGroup(classicPropertyRentStrategy, mediterraneanAvenue, balticAvenue);
            var lightBlueGroup = new PropertyGroup(classicPropertyRentStrategy, orientalAvenue, vermontAvenue, connecticutAvenue);
            var violetGroup    = new PropertyGroup(classicPropertyRentStrategy, stCharlesPlace, statesAvenue, virginiaAvenue);
            var orangeGroup    = new PropertyGroup(classicPropertyRentStrategy, stJamesPlace, tennesseeAvenue, newYorkAvenue);
            var redGroup       = new PropertyGroup(classicPropertyRentStrategy, kentuckyAvenue, indianaAvenue, illinoisAvenue);
            var yellowGroup    = new PropertyGroup(classicPropertyRentStrategy, atlanticAvenue, ventnorAvenue, marvinGardens);
            var darkGreenGroup = new PropertyGroup(classicPropertyRentStrategy, pacificAvenue, northCarolinaAvenue, pennsylvaniaAvenue);
            var darkBlueGroup  = new PropertyGroup(classicPropertyRentStrategy, parkPlace, boardwalk);
            var railroadGroup  = new PropertyGroup(new ClassicRailroadRentStrategy(), readingRailrod, pennsylvaniaRailroad, boRailroad, shortLine);
            var utilityGroup   = new PropertyGroup(new ClassicUtilityRentStrategy(), electricCompany, waterWorks);

            boardComponents = new List <BoardComponent>();
            boardComponents.Add(purpleGroup);
            boardComponents.Add(lightBlueGroup);
            boardComponents.Add(violetGroup);
            boardComponents.Add(orangeGroup);
            boardComponents.Add(redGroup);
            boardComponents.Add(yellowGroup);
            boardComponents.Add(darkGreenGroup);
            boardComponents.Add(darkBlueGroup);
            boardComponents.Add(railroadGroup);
            boardComponents.Add(utilityGroup);
            boardComponents.Add(go);
            boardComponents.Add(goToJail);
            boardComponents.Add(incomeTax);
            boardComponents.Add(luxuryTax);
            boardComponents.Add(justVisiting);
            boardComponents.Add(freeParking);
            boardComponents.Add(communityChestOne);
            boardComponents.Add(communityChestTwo);
            boardComponents.Add(communityChestThree);
            boardComponents.Add(chanceOne);
            boardComponents.Add(chanceTwo);
            boardComponents.Add(chanceThree);
        }
示例#8
0
 public void TestInitiaize()
 {
     goToJail = new GoToJail(30, "goToJail", jailLocation);
     player   = new Player("player");
 }