Exemple #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();
        }
Exemple #2
0
        public void SetUp()
        {
            playerIds = new[] { 0, 1, 2 };
            var banker = new TraditionalBanker(playerIds);

            turnFactory = new TraditionalTurnFactory(banker);
            game        = new Game(playerIds, turnFactory);
        }
Exemple #3
0
        public void SetUp()
        {
            var faker = new MotherFaker();

            jailRoster = faker.JailRoster;
            banker     = faker.Banker;
            gameBoard  = faker.GameBoard;
            dice       = faker.Dice;
            PutPlayerInJail();
        }
Exemple #4
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;
 }
Exemple #5
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));
        }
Exemple #6
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);
        }
Exemple #7
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));
        }
Exemple #8
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());
        }
Exemple #9
0
        public void TestGetDeckReturnsCardDeck()
        {
            var banker          = new TraditionalBanker(new[] { 0, 1 });
            var jailRoster      = new TraditionalJailRoster(banker);
            var locationManager = new GameBoard(banker);
            var chanceFactory   = new ChanceFactory(banker, jailRoster, locationManager, new FakeDice());

            var deck = chanceFactory.GetCards();

            Assert.That(deck.Count(), Is.EqualTo(16));
        }
Exemple #10
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());
        }
Exemple #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());
        }
Exemple #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());
        }
Exemple #13
0
 public void SetUp()
 {
     banker = new TraditionalBanker(new[] { 0, 1 });
 }
Exemple #14
0
 public TraditionalTurnFactory(TraditionalBanker banker)
 {
     this.banker = banker;
     board       = CreateBoard();
 }
Exemple #15
0
 public void SetUp()
 {
     playerId   = 0;
     banker     = new TraditionalBanker(new[] { playerId });
     jailRoster = new TraditionalJailRoster(banker);
 }