Beispiel #1
0
        public void CheckRows_GivenFullRow_ShouldReturnTrue_V1()
        {
            //arrange
            //playerName to be checked
            string playerName = "X";

            //new instance of board with allrows property
            var instanceOfBoard = new Board();

            string[][] instanceOfAllrows = instanceOfBoard.allrows;

            //marking row 0 with all X's(playerName)
            instanceOfAllrows[0][0] = playerName;
            instanceOfAllrows[0][1] = playerName;
            instanceOfAllrows[0][2] = playerName;

            //new instance of the WinnerFinder function
            var instanceOfWinnerFinder = new WinnerFinder(instanceOfAllrows);

            //action
            bool rowHasWinner = instanceOfWinnerFinder.CheckRows(playerName);

            //assert
            Assert.Equal(true, rowHasWinner);
        }
Beispiel #2
0
        public void CheckRows_GivenFullRow_ShouldReturnTrue_V2()
        {
            //arrange
            //playerName to be checked
            string playerName = "X";

            //new instance of board with allrows property

            string[] row1 = new string[3] {
                "X", "X", "X"
            };
            string[] row2 = new string[3] {
                ".", ".", "."
            };
            string[] row3 = new string[3] {
                ".", ".", "."
            };

            string[][] allrows = new string[][] { row1, row2, row3 };


            //new instance of the WinnerFinder function
            var instanceOfWinnerFinder = new WinnerFinder(allrows);

            //action
            bool rowHasWinner = instanceOfWinnerFinder.CheckRows(playerName);

            //assert
            Assert.Equal(true, rowHasWinner);
        }