public void AddCardToHand_OtherPlayersDidNotAddCard()
        {
            // Arrange
            WriteClass    write       = new WriteClass();
            FakeUserInput input       = new FakeUserInput();
            PlayersHand   playersHand = new PlayersHand(write, input);

            var expectedtList = new List <Player>();

            expectedtList.Add(new Player("Test", 0));
            expectedtList.Add(new Player("Test2", 1));
            expectedtList.Add(new Player("Test3", 2));

            // Act
            var    expected = input.GetStringInput();
            string deltCard = "testCard";

            playersHand.AddCardToHand(deltCard, expectedtList);

            // Assert
            foreach (var player in expectedtList)
            {
                if (player.Name != expected)
                {
                    Assert.IsFalse(player.Hand.Contains(deltCard));
                }
            }
        }
        public void GetStringInput_ReturnStringInput()
        {
            // Arrange
            FakeUserInput fakeInput = new FakeUserInput();
            // Act
            var actual   = fakeInput.GetStringInput();
            var expected = "Test";

            // Assert

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void EnterNameOfPlayersTest_PlayersName()
        {
            // Arrange
            WriteClass    writer        = new WriteClass();
            FakeUserInput userInput     = new FakeUserInput();
            CreatePlayers createPlayers = new CreatePlayers(writer, userInput);

            //Act
            int expected = userInput.GetIntInput();
            var actual   = createPlayers.EnterNameOfPlayers(expected);

            //Assert
            Assert.IsTrue(actual.Count == expected);
        }
Exemple #4
0
        public void HowManyPlayers_PostiveNumber()
        {
            // Arrange
            WriteClass    writer       = new WriteClass();
            FakeUserInput userInput    = new FakeUserInput();
            CreatePlayers createPlayer = new CreatePlayers(writer, userInput);
            int           expected     = 3;

            // Act
            var actual = createPlayer.HowManyPlayers();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void MenuTest_ReturnValue()
        {
            FakeWriterClass writer      = new FakeWriterClass();
            FakeUserInput   userInput   = new FakeUserInput(writer);
            PlayersHand     playersHand = new PlayersHand(writer, userInput);
            ShowPlayers     showPlayers = new ShowPlayers(writer);
            Deal            deal        = new Deal();
            Menu            menu        = new Menu(writer, deal, playersHand, showPlayers, userInput);


            var mockList = new List <Player>();

            mockList.Add(new Player("Test", 0));
            mockList.Add(new Player("Test1", 1));
            mockList.Add(new Player("Test2", 2));
            var mockDeck = new List <KeyValuePair <string, string> >();

            mockDeck.Add(new KeyValuePair <string, string>("Key1", "Value1"));
            mockDeck.Add(new KeyValuePair <string, string>("Key2", "Value2"));
            mockDeck.Add(new KeyValuePair <string, string>("Key3", "Value3"));
            menu.GameMenu(mockList, mockDeck);
        }