Esempio n. 1
0
        public void getPlayingStackAndStack_multipleCardsGrabbedAndGiven_MultipleCards()
        {
            //Arrange
            PlayingStackSingleton playingStackInstance = PlayingStackSingleton.GetInstance();
            int            amountBeforePlay            = playingStackInstance.GetStack().Count;
            StackSingleton stackInstance    = StackSingleton.GetInstance();
            int            amountBeforeGrab = stackInstance.GetStack().Count;
            User           user             = new User(1, "peter");
            User           user2            = new User(2, "steve");
            User           user3            = new User(3, "jack");

            //Act
            user.GrabCards(2);
            var card = user.GetCards()[0];

            user.PlayCard(card);

            user2.GrabCards(4);
            card = user2.GetCards()[0];
            user2.PlayCard(card);

            user3.GrabCards(4);
            card = user3.GetCards()[0];
            user3.PlayCard(card);

            //Assert
            int amountAfterPlay = playingStackInstance.GetStack().Count;
            int amountAfterGrab = stackInstance.GetStack().Count;

            Assert.AreEqual(amountBeforePlay + 3, amountAfterPlay);
            Assert.AreEqual(amountBeforeGrab - 10, amountAfterGrab);
        }
Esempio n. 2
0
        public void getPlayingStack_threeCardsGiven_threeCards()
        {
            //Arrange
            PlayingStackSingleton playingStackInstance = PlayingStackSingleton.GetInstance();
            int            amountBeforePlay            = playingStackInstance.GetStack().Count;
            StackSingleton stackInstance = StackSingleton.GetInstance();
            User           user          = new User(1, "peter");
            User           user2         = new User(2, "steve");
            User           user3         = new User(3, "jack");

            //Act
            user.GrabCards(2);
            string card = user.GetCards()[0];

            user.PlayCard(card);

            user2.GrabCards(2);
            card = user2.GetCards()[0];
            user2.PlayCard(card);

            user3.GrabCards(2);
            card = user3.GetCards()[0];
            user3.PlayCard(card);

            //Assert
            int amountAfterPlay = playingStackInstance.GetStack().Count;

            Assert.AreEqual(amountBeforePlay + 3, amountAfterPlay);
        }
Esempio n. 3
0
        public void getPlayingStack_oneWrongCardGiven_noCards()
        {
            //Arrange
            PlayingStackSingleton playingStackInstance = PlayingStackSingleton.GetInstance();
            int            amountBeforePlay            = playingStackInstance.GetStack().Count;
            StackSingleton stackInstance = StackSingleton.GetInstance();
            User           user          = new User(1, "peter");
            string         card          = "not possible";

            //Act
            user.PlayCard(card);

            //Assert
            int amountAfterPlay = playingStackInstance.GetStack().Count;

            Assert.AreEqual(amountBeforePlay, amountAfterPlay);
        }
Esempio n. 4
0
        public void getPlayingStack_oneCardGiven_oneCard()
        {
            //Arrange
            PlayingStackSingleton playingStackInstance = PlayingStackSingleton.GetInstance();
            int            amountBeforePlay            = playingStackInstance.GetStack().Count;
            StackSingleton stackInstance = StackSingleton.GetInstance();
            User           user          = new User(1, "peter");

            //Act
            user.GrabCards(2);
            string card = user.GetCards()[0];

            user.PlayCard(card);

            //Assert
            int amountAfterPlay = playingStackInstance.GetStack().Count;

            Assert.AreEqual(amountBeforePlay + 1, amountAfterPlay);
        }