예제 #1
0
        public void ExistingPotentialValueFound()
        {
            List <char> potentialValues = new List <char> {
                '1', '2', '3'
            };
            Cell cell1 = new Cell('0', potentialValues);

            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell2 = new Cell('0', potentialValues);

            cell1.SetNextCell(cell2);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell3 = new Cell('0', potentialValues);

            cell2.SetNextCell(cell3);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell4 = new Cell('0', potentialValues);

            cell3.SetNextCell(cell4);
            potentialValues = new List <char> {
                '1', '3', '5'
            };
            Cell cell5 = new Cell('0', potentialValues);

            cell4.SetNextCell(cell5);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell6 = new Cell('0', potentialValues);

            cell5.SetNextCell(cell6);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell7 = new Cell('0', potentialValues);

            cell6.SetNextCell(cell7);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell8 = new Cell('0', potentialValues);

            cell7.SetNextCell(cell8);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell9 = new Cell('0', potentialValues);

            cell8.SetNextCell(cell9);
            cell9.SetNextCell(cell1);

            Row row = new Row(0, cell1);

            Assert.IsTrue(row.CheckForExistenceOfPossibleValue('1', cell1));
        }
예제 #2
0
        public void DontUpdateValueWhenMultiPotentialValue()
        {
            List <char> potentialValues = new List <char> {
                '1', '2', '3'
            };
            Cell cell1 = new Cell('0', potentialValues);

            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell2 = new Cell('0', potentialValues);

            cell1.SetNextCell(cell2);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell3 = new Cell('0', potentialValues);

            cell2.SetNextCell(cell3);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell4 = new Cell('0', potentialValues);

            cell3.SetNextCell(cell4);
            potentialValues = new List <char> {
                '1', '3', '5'
            };
            Cell cell5 = new Cell('0', potentialValues);

            cell4.SetNextCell(cell5);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell6 = new Cell('0', potentialValues);

            cell5.SetNextCell(cell6);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell7 = new Cell('0', potentialValues);

            cell6.SetNextCell(cell7);
            potentialValues = new List <char> {
                '2'
            };
            Cell cell8 = new Cell('0', potentialValues);

            cell7.SetNextCell(cell8);
            potentialValues = new List <char> {
                '2', '3', '5'
            };
            Cell cell9 = new Cell('0', potentialValues);

            cell8.SetNextCell(cell9);
            cell9.SetNextCell(cell1);

            Row row = new Row(0, cell1);

            Assert.IsFalse(cell7.UpdateValueIfOnlyPossibility());
            Assert.AreEqual('0', cell7.GetValue());
        }