public void TestNoFileExists() { // 1. Arrange: if (File.Exists("ProgressLog.txt")) { File.Delete("ProgressLog.txt"); } DataReader reader = new DataReader(); // 2. Act: reader.Winning(Global.PLAYER1); // 3. Assert: Assert.IsTrue(File.Exists(reader.path)); }
/********************************************************************* * This is a constructor. It initializes the matrix behind the * tictactoe, the moveCounter, the dataReader and currentPlayer. * INPUT: none. * OUTPUT: none. *********************************************************************/ public Logic() { moveCounter = 0; dataReader = new DataReader(); currentPlayer = Global.PLAYER1; matrix = new List<List<string>>(); for (int i = 0; i < 3; i++) { matrix.Add(new List<string>()); for (int j = 0; j < 3; j++) { matrix[i].Add("E"); } } }
public void TestPlayer2Win() { // 1. Arrange: DataReader reader = new DataReader(); int player1 = Global.PLAYER1WIN; int player2 = Global.PLAYER2WIN; int ties = Global.TIENUMBER; // 2. Act: reader.Winning(Global.PLAYER2); // 3. Assert: Assert.AreEqual(player1, Global.PLAYER1WIN); Assert.AreEqual(player2 + 1, Global.PLAYER2WIN); Assert.AreEqual(ties, Global.TIENUMBER); }