public void TestGetHashCode() { SudokuDifficulty newDifficulty = SudokuPuzzleTest.Difficulty == SudokuDifficulty.None ? SudokuDifficulty.Easy : SudokuDifficulty.None; SudokuPuzzle puzzle = new SudokuPuzzle(this.Sudoku.Size, newDifficulty); SudokuGenerator.AddNumbers(puzzle); for (int i = 0; i < this.Sudoku.Size; i++) { for (int j = 0; j < this.Sudoku.Size; j++) { this.Sudoku[i, j] = puzzle[i, j]; } } int hashCode = puzzle.GetHashCode(); Assert.AreEqual(this.Sudoku, puzzle); Assert.AreEqual(this.Sudoku.GetHashCode(), hashCode); this.Sudoku[0, 0] = 0; Assert.AreNotEqual(this.Sudoku, puzzle); Assert.AreNotEqual(this.Sudoku.GetHashCode(), hashCode); }