예제 #1
0
        public void TestIsWonInTopHorizonalPositionForX()
        {
            // 1. Arrange:
            Logic logic = new Logic();

            // 2. Act:
            logic.matrix[0][0] = "X";
            logic.matrix[0][1] = "X";
            logic.matrix[0][2] = "X";

            // 3. Assert:
            Assert.IsTrue(logic.IsWon());
        }
예제 #2
0
        public void TestIsWonInRightVerticalPositionForO()
        {
            // 1. Arrange:
            Logic logic = new Logic();

            // 2. Act:
            logic.matrix[2][0] = "O";
            logic.matrix[2][1] = "O";
            logic.matrix[2][2] = "O";

            //3. Assert:
            Assert.IsTrue(logic.IsWon());
        }
예제 #3
0
        public void TestIsWonInDiagonalPositionForXTopLeftToBottomRight()
        {
            // 1. Arrange:
            Logic logic = new Logic();

            // 2. Act:
            logic.matrix[0][0] = "X";
            logic.matrix[1][1] = "X";
            logic.matrix[2][2] = "X";

            //3. Assert:
            Assert.IsTrue(logic.IsWon());
        }
예제 #4
0
        public void TestIsWonInLeftVerticalPositionForX()
        {
            // 1. Arrange:
            Logic logic = new Logic();

            // 2. Act:
            logic.matrix[0][0] = "X";
            logic.matrix[1][0] = "X";
            logic.matrix[2][0] = "X";

            //3. Assert:
            Assert.IsTrue(logic.IsWon());
        }
예제 #5
0
        public void TestIsWonForRandomGameWhereThereIsATie()
        {
            // 1. Arrange:
            Logic logic = new Logic();

            // 2. Act:
            logic.matrix[0][0] = "X";
            logic.matrix[0][1] = "O";
            logic.matrix[0][2] = "X";
            logic.matrix[1][0] = "X";
            logic.matrix[1][1] = "O";
            logic.matrix[1][2] = "X";
            logic.matrix[2][0] = "O";
            logic.matrix[2][1] = "X";
            logic.matrix[2][2] = "O";

            // 3. Assert:
            Assert.IsFalse(logic.IsWon());
        }