Ejemplo n.º 1
0
        public void GetExpectedCards_FullFireworkPile_ReturnsEmptyList()
        {
            IGameProvider provider = new FakeGameProvider()
            {
                Colors = new List <Color> {
                    Color.Blue, Color.Green
                },
                Ranks = new List <Rank> {
                    Rank.One, Rank.Two
                },
            };

            var fireworkPile = new FireworkPile(provider);

            var blueOneCard = new Card(Color.Blue, Rank.One);

            fireworkPile.AddCard(blueOneCard);

            var blueTwoCard = new Card(Color.Blue, Rank.Two);

            fireworkPile.AddCard(blueTwoCard);

            var greenOneCard = new Card(Color.Green, Rank.One);

            fireworkPile.AddCard(greenOneCard);

            var greenTwoCard = new Card(Color.Green, Rank.Two);

            fireworkPile.AddCard(greenTwoCard);

            IReadOnlyList <Card> actual = fireworkPile.GetExpectedCards();

            Assert.IsEmpty(actual);
        }
Ejemplo n.º 2
0
        public void IsSubtleClue_FireworkWithBlueAndGreenOneAndCluesAboutOne_ReturnsFalse()
        {
            var firework = new FireworkPile(new GameProvider());

            firework.AddCard(new Card(Color.Blue, Rank.One));
            firework.AddCard(new Card(Color.Green, Rank.One));

            var clue = new ClueAboutRank(Rank.One);

            // act
            bool result = clue.IsSubtleClue(firework.GetExpectedCards());

            // assert
            Assert.IsFalse(result);
        }
Ejemplo n.º 3
0
        public void IsSubtleClue_FireworkWithAllOnesExceptRedAndYellowAndCluesAboutOne_ReturnsTrue()
        {
            var firework = new FireworkPile(new GameProvider());

            firework.AddCard(new Card(Color.Blue, Rank.One));
            firework.AddCard(new Card(Color.Green, Rank.One));
            firework.AddCard(new Card(Color.White, Rank.One));

            var clue = new ClueAboutRank(Rank.One);

            // act
            bool result = clue.IsSubtleClue(firework.GetExpectedCards());

            // assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 4
0
        public void GetExpectedCards_EmptyFireworkPile_ReturnsListWithFiveElements()
        {
            IGameProvider provider = new FakeGameProvider()
            {
                Colors = new List <Color> {
                    Color.Blue, Color.Green, Color.Red, Color.White, Color.Yellow
                },
                Ranks = new List <Rank> {
                    Rank.One
                }
            };


            var fireworkPile = new FireworkPile(provider);

            IReadOnlyList <Card> actual = fireworkPile.GetExpectedCards();

            Assert.AreEqual(5, actual.Count);
        }
Ejemplo n.º 5
0
        public void GetExpectedCards_FireworkPileWithFullRedFirework_ReturnsListWithoutRedCards()
        {
            IGameProvider provider = new FakeGameProvider()
            {
                Colors = new List <Color> {
                    Color.Red, Color.Blue
                },
                Ranks = new List <Rank> {
                    Rank.One, Rank.Two, Rank.Three, Rank.Four, Rank.Five
                },
            };

            var fireworkPile = new FireworkPile(provider);

            fireworkPile.AddCard(new Card(Color.Red, Rank.One));
            fireworkPile.AddCard(new Card(Color.Red, Rank.Two));
            fireworkPile.AddCard(new Card(Color.Red, Rank.Three));
            fireworkPile.AddCard(new Card(Color.Red, Rank.Four));
            fireworkPile.AddCard(new Card(Color.Red, Rank.Five));

            IReadOnlyList <Card> actual = fireworkPile.GetExpectedCards();

            Assert.IsTrue(actual.All(card => card.Color != Color.Red));
        }
Ejemplo n.º 6
0
        public void GetExpectedCards_BlueFireworkWithLastFour_ReturnsListWithBlueFive()
        {
            IGameProvider provider = new FakeGameProvider()
            {
                Colors = new List <Color> {
                    Color.Blue
                },
                Ranks = new List <Rank> {
                    Rank.One, Rank.Two, Rank.Three, Rank.Four, Rank.Five
                }
            };
            var fireworkPile = new FireworkPile(provider);

            fireworkPile.AddCard(new Card(Color.Blue, Rank.One));
            fireworkPile.AddCard(new Card(Color.Blue, Rank.Two));
            fireworkPile.AddCard(new Card(Color.Blue, Rank.Three));
            fireworkPile.AddCard(new Card(Color.Blue, Rank.Four));

            var expectedCards = fireworkPile.GetExpectedCards();

            var blueFiveCard = new Card(Color.Blue, Rank.Five);

            Assert.That(expectedCards.Any(card => card.Equals(blueFiveCard)));
        }
Ejemplo n.º 7
0
        public void GetExpectedCards_FullBlueFirework_ReturnsNullForBlueColor()
        {
            IGameProvider provider = new FakeGameProvider()
            {
                Colors = new List <Color> {
                    Color.Blue, Color.White
                },
                Ranks = new List <Rank> {
                    Rank.One, Rank.Two, Rank.Three, Rank.Four, Rank.Five
                },
            };

            var pile = new FireworkPile(provider);

            pile.AddCard(new Card(Color.Blue, Rank.One));
            pile.AddCard(new Card(Color.Blue, Rank.Two));
            pile.AddCard(new Card(Color.Blue, Rank.Three));
            pile.AddCard(new Card(Color.Blue, Rank.Four));
            pile.AddCard(new Card(Color.Blue, Rank.Five));

            var nextCards = pile.GetExpectedCards();

            Assert.That(nextCards.All(card => card.Color != Color.Blue));
        }