Exemplo n.º 1
0
        public void TestCheck_Diagonals()
        {
            target = new StandardVictoryValidator();
            var boards = new[]
            {
                new MarkType[, ]
                {
                    { MarkType.Cross, MarkType.None, MarkType.Nought },
                    { MarkType.None, MarkType.Cross, MarkType.None },
                    { MarkType.Nought, MarkType.None, MarkType.Cross }
                },
                new MarkType[, ]
                {
                    { MarkType.Nought, MarkType.None, MarkType.Cross },
                    { MarkType.None, MarkType.Cross, MarkType.None },
                    { MarkType.Cross, MarkType.None, MarkType.Nought }
                }
            };

            foreach (var board in boards)
            {
                Assert.IsTrue(target.Check(board, MarkType.Cross) == GameState.Victory);
                Assert.IsFalse(target.Check(board, MarkType.Nought) == GameState.Victory);
            }
        }
Exemplo n.º 2
0
        public void TestCheck_Draw()
        {
            target = new StandardVictoryValidator();

            var board = new MarkType[, ]
            {
                { MarkType.Cross, MarkType.Nought, MarkType.Cross },
                { MarkType.Cross, MarkType.Nought, MarkType.Cross },
                { MarkType.Nought, MarkType.Cross, MarkType.Nought }
            };

            Assert.IsTrue(target.Check(board, MarkType.Cross) == GameState.Draw);
            Assert.IsTrue(target.Check(board, MarkType.Nought) == GameState.Draw);
        }