示例#1
0
        public void PlayersShouldHaveTokens()
        {
            var noThanks = new NoThanksGame();

            var players = noThanks.Components.OfType<Player>();

            var tokenCounts = players.Select(p => p.Components.OfType<Token>().Count());

            tokenCounts.Any(c => c != 11).ShouldBeFalse();
        }
示例#2
0
        public void ShouldHaveOneAndOnlyOneDeck()
        {
            var noThanks = new NoThanksGame();

            var decks = noThanks.Components.OfType<CardDeck>();

            decks.Count().ShouldEqual(1);
        }
示例#3
0
        public void ShouldHaveCards2To34()
        {
            var expectedRange = Enumerable.Range(2, 33).ToList();

            var noThanks = new NoThanksGame();

            var deck = noThanks.Components.OfType<CardDeck>().Single();

            var actualRange = deck.Cards.Select(c => c.NumericValue).OrderBy(i => i);

            expectedRange.Except(actualRange).Count().ShouldEqual(0);
            actualRange.Except(expectedRange).Count().ShouldEqual(0);
        }
示例#4
0
        public void StartingAGame()
        {
            var noThanks = new NoThanksGame();

            noThanks.Start();

            var deck = noThanks.Components.OfType<CardDeck>().Single();

            var card = deck.ActiveCard;

            card.ShouldNotBeNull();
        }
示例#5
0
        public void ShouldHavePlayers()
        {
            var noThanks = new NoThanksGame();

            var players = noThanks.Components.OfType<Player>();

            players.Count().ShouldBeInRange(2, 5);
        }