Ejemplo n.º 1
0
 public void Should_NOT_refill_draw_deck_from_discards_when_empty()
 {
     var drawDeck = new DrawDeck(new List<ICard> { _copper, _estate }, _discardPile);
     drawDeck.TopCard.MoveTo(_discardPile);
     drawDeck.TopCard.MoveTo(_discardPile);
     drawDeck.CardCount.ShouldEqual(0);
 }
Ejemplo n.º 2
0
 public void Should_replace_top_card_when_moved()
 {
     var drawDeck = new DrawDeck(new List<ICard> { _copper, _estate }, _discardPile);
     drawDeck.TopCard.ShouldEqual(_copper);
     drawDeck.TopCard.MoveTo(_discardPile);
     drawDeck.TopCard.ShouldEqual(_estate);
 }
Ejemplo n.º 3
0
 public void Should_add_cards_passed_via_constructor()
 {
     var drawDeck = new DrawDeck(new List<ICard> { _copper, _estate }, _discardPile);
     drawDeck.CardCount.ShouldEqual(2);
     _copper.CurrentZone.ShouldEqual(drawDeck);
     _estate.CurrentZone.ShouldEqual(drawDeck);
 }
Ejemplo n.º 4
0
        public void Should_refill_draw_deck_from_discards_when_card_required()
        {
            var drawDeck = new DrawDeck(new List<ICard> { _copper, _estate }, _discardPile);
            var hand = new Hand();

            // First move the copper to the discard pile
            drawDeck.TopCard.MoveTo(_discardPile);

            // Next move the estate to the hand
            drawDeck.TopCard.MoveTo(hand);
            
            drawDeck.TopCard.ShouldEqual(_copper);
        }
Ejemplo n.º 5
0
        public Player(string name, IEnumerable<ICard> startingDeck)
        {
            Id = Guid.NewGuid();
            Name = name;
            Discards = new DiscardPile();

            Deck = new DrawDeck(startingDeck, Discards);
            Deck.Shuffle();

            Hand = new Hand();
            DrawCards(5);

            PlayArea = new PlayArea();                       
        }
Ejemplo n.º 6
0
        public Player(string name, IEnumerable <ICard> startingDeck)
        {
            Id       = Guid.NewGuid();
            Name     = name;
            Discards = new DiscardPile();

            Deck = new DrawDeck(startingDeck, Discards);
            Deck.Shuffle();

            Hand = new Hand();
            DrawCards(5);

            PlayArea = new PlayArea();
        }
Ejemplo n.º 7
0
        public void Should_shuffle_deck_after_being_refilled()
        {
            var cards = new List<ICard>();
            15.Times(() => cards.Add(new Copper()));
            15.Times(() => cards.Add(new Estate()));

            var drawDeck = new DrawDeck(cards, _discardPile);

            // Move all the cards to the discard pile
            drawDeck.MoveAll(_discardPile);

            // Peek at the top card to trigger a shuffle
            var topCard = drawDeck.TopCard;

            var cardsAfterShuffle = new List<ICard>();
            30.Times(() =>
            {
                cardsAfterShuffle.Add(drawDeck.TopCard);
                drawDeck.TopCard.MoveTo(_discardPile);
            });

            Assert.AreNotEqual(cards, cardsAfterShuffle);
        }
Ejemplo n.º 8
0
 public DeckViewModel(DrawDeck deck)
 {
     CountDescription = deck.CardCount.ToString();
     IsEmpty = deck.CardCount == 0;
 }