コード例 #1
0
        public PropertyGroup ConstructorInitializesPropertyGroupCorrectly(PropertyGroup group)
        {
            location = new Location(0, group);

            return location.Group;
        }
コード例 #2
0
        public int ConstructorInitializesSpaceNumberCorrectly(int spaceNumber)
        {
            location = new Location(spaceNumber, PropertyGroup.Go);

            return location.SpaceNumber;
        }
コード例 #3
0
ファイル: ClassicBoard.cs プロジェクト: kawillia/MonopolyKata
        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);
        }