using System; using Xunit; using BoardUnitTesting; namespace BoardUnitTests { public class BoardTests { [Fact] public void BoardCreationTest() { int width = 3; int height = 3; Board board = new Board(width, height, '_'); char[,] testBoard = TestBoardCreate(width, height, '_'); Assert.True(board.IsIdentical(testBoard, width, height)); } [Fact] public void BoardResetTest() { int width = 3; int height = 3; Board board = new Board(width, height, '_'); char[,] testBoard = TestBoardCreate(width, height, '_'); board.SetValue(1, 1, 'X'); // This should be cleared board.Reset(); Assert.True(board.IsIdentical(testBoard, width, height)); } [Fact] public void BoardSetValueTest() { int width = 3; int height = 3; char expectedValue = 'X'; char actualValue; Board board = new Board(width, height, '_'); Assert.True(board.SetValue(1, 1, expectedValue)); Assert.True(board.GetValue(1, 1, out actualValue)); Assert.Equal(actualValue, expectedValue); } // This is not a test, it is setup code for a test private char[,] TestBoardCreate(int width, int height, char reset) { char[,] testBoard = new char[width, height]; // Setup the test board for (int column = 0; column < width; column++) { for (int row = 0; row < height; row++) { testBoard[column, row] = reset; } } return testBoard; } } }