public void CheckEachRowForDuplicatesTest_DuplicatesFound_OnOneRow() { Number num1 = new Number(1, 1, 1, true, false); Number num2 = new Number(2, 1, 1, true, false); Row row1 = new Row(1); row1.array.Add(num1); row1.array.Add(num2); rows.Add(row1); bool expected = true; bool actual = Program.CheckEachRowForDuplicates(rows); Assert.AreEqual(expected, actual); }
private static void DivideArray() { rows = new List<Row>(); columns = new List<Column>(); blocks3x3 = new List<Block>(); for (int y = 1; y <= A; y++) { Row row = new Row(y); for (int x = 1; x <= A; x++) foreach (Number item in array) if (item.x == x && item.y == y) row.array.Add(item); rows.Add(row); } for (int x = 1; x <= A; x++) { Column column = new Column(x); for (int y = 1; y <= A; y++) foreach (Number item in array) if (item.x == x && item.y == y) column.array.Add(item); columns.Add(column); } for (int y1 = 1; y1 <= 3; y1++) { for (int x1 = 1; x1 <= 3; x1++) { Block block = new Block(x1, y1); foreach (Number item in array) if (isNumberInParticularBlock(x1, y1, item)) block.al.Add(item); blocks3x3.Add(block); } } }