예제 #1
0
        public void should_get_empty_candidates_for_locked_cell()
        {
            var sudokuBoard = new SudokuBoard();
            var position    = new Position(0, 0);

            sudokuBoard.Set(position, 2, true);

            var candidates = new GeneralCandidateRule(sudokuBoard).GetCandidates(position);

            Assert.Equal(0, candidates.Count);
        }
예제 #2
0
        public void should_get_candidates_for_unlocked_cell()
        {
            var sudokuBoard = new SudokuBoard();
            var position = new Position(0,0);
            var candidates = new GeneralCandidateRule(sudokuBoard).GetCandidates(position);
            Assert.Equal(9, candidates.Count);

            sudokuBoard.Set(new Position(0, 1), 2, false);
            sudokuBoard.Set(new Position(0, 2), 3, false);
            sudokuBoard.Set(new Position(0, 3), 4, false);
            sudokuBoard.Set(new Position(0, 4), 5, false);
            sudokuBoard.Set(new Position(0, 5), 6, false);
            sudokuBoard.Set(new Position(0, 6), 7, false);
            sudokuBoard.Set(new Position(0, 7), 8, false);
            sudokuBoard.Set(new Position(0, 8), 9, false);
            candidates = new GeneralCandidateRule(sudokuBoard).GetCandidates(position);
            Assert.Equal(1, candidates.Count);
            Assert.Equal(1, candidates.First());
        }
예제 #3
0
        public void should_get_candidates_for_unlocked_cell()
        {
            var sudokuBoard = new SudokuBoard();
            var position    = new Position(0, 0);
            var candidates  = new GeneralCandidateRule(sudokuBoard).GetCandidates(position);

            Assert.Equal(9, candidates.Count);

            sudokuBoard.Set(new Position(0, 1), 2, false);
            sudokuBoard.Set(new Position(0, 2), 3, false);
            sudokuBoard.Set(new Position(0, 3), 4, false);
            sudokuBoard.Set(new Position(0, 4), 5, false);
            sudokuBoard.Set(new Position(0, 5), 6, false);
            sudokuBoard.Set(new Position(0, 6), 7, false);
            sudokuBoard.Set(new Position(0, 7), 8, false);
            sudokuBoard.Set(new Position(0, 8), 9, false);
            candidates = new GeneralCandidateRule(sudokuBoard).GetCandidates(position);
            Assert.Equal(1, candidates.Count);
            Assert.Equal(1, candidates.First());
        }
예제 #4
0
        public void should_get_empty_candidates_for_locked_cell()
        {
            var sudokuBoard = new SudokuBoard();
            var position = new Position(0, 0);
            sudokuBoard.Set(position, 2, true);

            var candidates = new GeneralCandidateRule(sudokuBoard).GetCandidates(position);
            Assert.Equal(0, candidates.Count);
        }