예제 #1
0
 private void CreateAndPlayGame(IEnumerable<Int32> playerIds)
 {
     var banker = new TraditionalBanker(playerIds);
     var turnFactory = new TraditionalTurnFactory(banker);
     game = new Game(playerIds, turnFactory);
     game.Play();
 }
예제 #2
0
파일: GameTests.cs 프로젝트: kevPo/Monopoly
 public void SetUp()
 {
     playerIds = new[] { 0, 1, 2 };
     var banker = new TraditionalBanker(playerIds);
     turnFactory = new TraditionalTurnFactory(banker);
     game = new Game(playerIds, turnFactory);
 }
예제 #3
0
        public void TestCollect50Adds50ToPlayersBalance()
        {
            var playerId = 0;
            var banker = new TraditionalBanker(new[] { playerId });
            var collectMoneyCommand = new CollectMoneyCommand(banker, 50);
            collectMoneyCommand.PerformOn(playerId);

            Assert.That(banker.GetBalanceFor(playerId), Is.EqualTo(1550));
        }
예제 #4
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);
 }
예제 #5
0
 public void SetUp()
 {
     var faker = new MotherFaker();
     jailRoster = faker.JailRoster;
     banker = faker.Banker;
     gameBoard = faker.GameBoard;
     dice = faker.Dice;
     PutPlayerInJail();
 }
예제 #6
0
 public MotherFaker()
 {
     Dice = new FakeDice();
     Banker = new TraditionalBanker(new[] { 0 });
     JailRoster = new TraditionalJailRoster(Banker);
     GameBoard = new GameBoard(Banker);
     var cardDeckFactory = new TraditionalCardDeckFactory(Banker, JailRoster, GameBoard, Dice);
     LocationFactory = new TraditionalLocationFactory(Banker, Dice, JailRoster, GameBoard, cardDeckFactory);
     GameBoard.SetLocations(LocationFactory.GetLocations(), LocationFactory.GetRailroads(), LocationFactory.GetUtilities());
 }
예제 #7
0
        public void TestGetDeckReturnsACardDeck()
        {
            var banker = new TraditionalBanker(new[] { 0, 1 });
            var jailRoster = new TraditionalJailRoster(banker);
            var locationManager = new GameBoard(banker);
            var communityChestFactory = new CommunityChestFactory(banker, jailRoster, locationManager);

            var deck = communityChestFactory.GetCards();
            Assert.That(deck.Count(), Is.EqualTo(16));
        }
예제 #8
0
        public void TestPayMoneyCommandFor100MakesPlayerPay100ToBank()
        {
            var playerId = 0;
            var banker = new TraditionalBanker(new[] { playerId });
            var payMoneyCommand = new PayMoneyCommand(banker, 100);

            payMoneyCommand.PerformOn(playerId);

            Assert.That(banker.GetBalanceFor(playerId), Is.EqualTo(1400));
        }
예제 #9
0
 public void SetUp()
 {
     playerId = 0;
     banker = new TraditionalBanker(new[] { playerId });
     jailRoster = new TraditionalJailRoster(banker);
     board = new GameBoard(banker);
     cardDeckFactory = new FakeCardDeckFactory(CreateCards());
     var locationFactory = new TraditionalLocationFactory(banker, dice, jailRoster, board, cardDeckFactory);
     board.SetLocations(locationFactory.GetLocations(), locationFactory.GetRailroads(), locationFactory.GetUtilities());
 }
예제 #10
0
 public TraditionalLocationFactory(TraditionalBanker banker, IDice dice, 
     TraditionalJailRoster jailRoster, IBoard board,
     CardDeckFactory cardDeckFactory)
 {
     this.banker = banker;
     this.dice = dice;
     this.jailRoster = jailRoster;
     this.board = board;
     this.cardDeckFactory = cardDeckFactory;
 }
예제 #11
0
 public void SetUp()
 {
     banker = new TraditionalBanker(new[] { 0 });
     jailRoster = new TraditionalJailRoster(banker);
     board = new GameBoard(banker);
     var dice = new FakeDice();
     var cardDeckFactory = new FakeCardDeckFactory(CreateCards());
     communityChest = new CardDraw(0, "Community Chest", banker, cardDeckFactory.GetCommunityChestDeck());
     var traditionalLocationFactory =
         new TraditionalLocationFactory(banker, dice, jailRoster, board, cardDeckFactory);
     board.SetLocations(traditionalLocationFactory.GetLocations(), traditionalLocationFactory.GetRailroads(), traditionalLocationFactory.GetUtilities());
 }
예제 #12
0
 public virtual void SetUp()
 {
     playerOneId = 0;
     playerTwoId = 1;
     playerThreeId = 2;
     playerFourId = 3;
     playerFiveId = 4;
     banker = new TraditionalBanker(new[] { playerOneId, playerTwoId, playerThreeId, playerFourId, playerFiveId });
     jailRoster = new TraditionalJailRoster(banker);
     gameBoard = new GameBoard(banker);
     dice = new FakeDice();
     var cardDeckFactory = new TraditionalCardDeckFactory(banker, jailRoster, gameBoard, dice);
     var locationFactory = new TraditionalLocationFactory(banker, dice, jailRoster, gameBoard, cardDeckFactory);
     gameBoard.SetLocations(locationFactory.GetLocations(), locationFactory.GetRailroads(), locationFactory.GetUtilities());
 }
예제 #13
0
 public void SetUp()
 {
     playerId = 0;
     banker = new TraditionalBanker(new[] { playerId });
     jailRoster = new TraditionalJailRoster(banker);
 }
예제 #14
0
 public void SetUp()
 {
     banker = new TraditionalBanker(new[] { 0, 1 });
 }
예제 #15
0
 public TraditionalTurnFactory(TraditionalBanker banker)
 {
     this.banker = banker;
     board = CreateBoard();
 }