Ejemplo n.º 1
0
        public void UndoMove_With_Not_Executed_Move_Should_Not_Alter_PuzzleState()
        {
            SudokuPuzzle sudokuPuzzle = new SudokuGenerator().Generate();
            SudokuMove   sudokuMove   = new SudokuMove(1, 1, 9);

            Assert.IsFalse(sudokuPuzzle.ExecuteMove(sudokuMove));
        }
Ejemplo n.º 2
0
        public void TestGetHashCode()
        {
            SudokuMove move     = this.Move;
            int        hashCode = this.Move.GetHashCode();

            Assert.AreEqual(move.GetHashCode(), hashCode);
            move = new SudokuMove(1, 1, 1, SudokuPattern.HiddenSingle, new int[] { 1 });
            Assert.AreNotEqual(move.GetHashCode(), hashCode);
        }
Ejemplo n.º 3
0
        public void TestProperties()
        {
            int[]      array = new int[] { 1, SudokuPuzzle.MaximumSupportedSize };
            SudokuMove move  = new SudokuMove(array, array, array, SudokuPattern.HiddenSingle, array);

            Assert.IsTrue(SudokuCellTest.Equal(array, move.Columns));
            Assert.IsTrue(SudokuCellTest.Equal(array, move.Numbers));
            Assert.IsTrue(SudokuCellTest.Equal(array, move.Possible));
            Assert.IsTrue(SudokuCellTest.Equal(array, move.Rows));
        }
Ejemplo n.º 4
0
        public void TestEquals()
        {
            SudokuMove move = this.Move;

            Assert.IsTrue(this.Move.Equals(move));
            Assert.IsTrue(this.Move == move);
            Assert.IsFalse(this.Move != move);
            Assert.AreEqual(this.Move, move);
            Assert.IsFalse(this.Move.Equals(new Object()));
            Assert.IsFalse(this.Move.Equals(null));
            move = null;
            Assert.IsFalse(this.Move == null);
            Assert.IsFalse(null == this.Move);
            Assert.IsTrue(move == null);
            move = new SudokuMove(1, 1, 1, SudokuPattern.HiddenSingle, new int[] { 1 });
            Assert.IsFalse(this.Move == move);
        }
Ejemplo n.º 5
0
        public void Initialize()
        {
            const int NUMBER = SudokuPuzzle.MaximumSupportedSize;

            this.Move = new SudokuMove(NUMBER, NUMBER, NUMBER, SudokuPattern.HiddenSingle, new int[] { NUMBER });
        }