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