private Turn CreateTurnWithSpecificCards(IDice dice, IEnumerable <ICard> cards) { cardDeckFactory = new FakeCardDeckFactory(cards); var locationFactory = new TraditionalLocationFactory(banker, dice, jailRoster, board, cardDeckFactory); board.SetLocations(locationFactory.GetLocations(), locationFactory.GetRailroads(), locationFactory.GetUtilities()); return(new NormalTurn(playerId, dice, jailRoster, board)); }
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; }
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 void testCardUniqueness() { int numberOfCards = 4 * 13; ISet <Card> cardSet = new HashSet <Card>(); var cardDeck = CardDeckFactory.Create(); for (int i = 0; i < numberOfCards; i++) { cardSet.Add(cardDeck.DealOneCard()); } Assert.AreEqual(cardSet.Count, numberOfCards); }
public void testCardUniquenessWithShuffle() { //Arrange IRandomNumberGenerator numberGenerator = new RandomNumberGenerator(); int numberOfCards = 4 * 13; ISet <Card> cardSet = new HashSet <Card>(); var cardDeck = CardDeckFactory.Create(); //Act for (int i = 0; i < numberOfCards; i++) { cardDeck.Shuffle(numberGenerator); cardSet.Add(cardDeck.DealOneCard()); } //Assert Assert.AreEqual(cardSet.Count, numberOfCards); }
public void testTwoDeckInOne() { //Arrange IRandomNumberGenerator numberGenerator = new RandomNumberGenerator(); int numberOfCards = 4 * 13; ISet <Card> cardSet = new HashSet <Card>(); var cardDeck = CardDeckFactory.Create(); List <Card> twoDeckInOne = new List <Card>(cardDeck.Cards); twoDeckInOne.AddRange(cardDeck.Cards); var twoCardDeck = new CardDeck(twoDeckInOne); //Act for (int i = 0; i < numberOfCards * 2; i++) { twoCardDeck.Shuffle(numberGenerator); cardSet.Add(twoCardDeck.DealOneCard()); } //Assert Assert.AreEqual(cardSet.Count, numberOfCards); }