public void TestWinAtDiagonal2() { /* Test win at top-right to left-bottom. * - | O | X * - | X | O * X | - | - */ Tictactoe game = new Tictactoe(); game.Put(game.NextPlayer(), 0, 2); // X Assert.IsFalse(game.Win(), "Not by this 1st run"); game.Put(game.NextPlayer(), 1, 0); // O Assert.IsFalse(game.Win(), "Not by this 2st run"); game.Put(game.NextPlayer(), 1, 1); // X Assert.IsFalse(game.Win(), "Not by this 3st run"); game.Put(game.NextPlayer(), 2, 1); // O Assert.IsFalse(game.Win(), "Not by this 4st run"); game.Put(game.NextPlayer(), 2, 0); // X Assert.IsTrue(game.Win(), "X shold be win by this turn"); // X wins. }
public void TestWinAtCol1() { /* Test win at first column. * X | O | O * X | O | - * X | - | - */ Tictactoe game = new Tictactoe(); game.Put(game.NextPlayer(), 0, 0); // X Assert.IsFalse(game.Win(), "Not by this 1st run"); game.Put(game.NextPlayer(), 1, 0); // O Assert.IsFalse(game.Win(), "Not by this 2st run"); game.Put(game.NextPlayer(), 0, 1); // X Assert.IsFalse(game.Win(), "Not by this 3st run"); game.Put(game.NextPlayer(), 1, 1); // O Assert.IsFalse(game.Win(), "Not by this 4st run"); game.Put(game.NextPlayer(), 0, 2); // X Assert.IsTrue(game.Win(), "X shold be win by this turn"); // X wins. }