public void IndexTest() { int index = 1; Column target = new Column(index); int actual; actual = target.Index; Assert.AreEqual(index, actual); }
public void CellsTest() { int index = 0; // TODO: Initialize to an appropriate value Column target = new Column(index); // TODO: Initialize to an appropriate value Cell[] expected = new Cell[9]; Cell[] actual; actual = target.Cells; CollectionAssert.AreEqual(expected, actual); }
public void IsCompleteTest() { int index = 0; Column target = new Column(index); for (int i = 0; i < 9; i++) target.Cells[i] = new Cell(); bool expected = false; bool actual; actual = target.IsComplete(); Assert.AreEqual(expected, actual); for (int i = 0; i < 9; i++) target.Cells[i].Digit = 2; expected = false; actual = target.IsComplete(); Assert.AreEqual(expected, actual); for (int i = 0; i < 9; i++) target.Cells[i].Digit = i + 1; expected = true; actual = target.IsComplete(); Assert.AreEqual(expected, actual); }
public void ColumnConstructorTest() { int index = 0; Column target = new Column(index); Assert.IsNotNull(target); }
public void ToStringTest() { int index = 1; Column target = new Column(index); string expected = "C2"; string actual; actual = target.ToString(); Assert.AreEqual(expected, actual); }
public void SetCandidatesTest() { int index = 0; Column target = new Column(index); for (int i = 0; i < 9; i++) { target.Cells[i] = new Cell(); target.Cells[i].Column = target; } // Check that all digits are candidate : foreach (Cell cell in target.GetCells()) for (int digit = 1; digit <= 9; digit++) Assert.AreEqual(true, cell.HasACandidateFor(digit)); target.SetCandidates(); // Check that all digits are candidate : foreach (Cell cell in target.GetCells()) for (int digit = 1; digit <= 9; digit++) Assert.AreEqual(true, cell.HasACandidateFor(digit)); target.Cells[0].Digit = 1; //target.SetCandidates(); // Check that 1 is no more a candidate : foreach (Cell cell in target.GetCells()) Assert.AreEqual(false, cell.HasACandidateFor(1)); // Check that all other digits are candidate // (except for the first cell) : for (int i = 1; i < 9; i++) { for (int digit = 2; digit <= 9; digit++) Assert.AreEqual(true, target.Cells[i].HasACandidateFor(digit), string.Format("({0} Candidate for {1})", target.Cells[i], digit)); } }
public void RemoveCandidateTest() { int index = 1; Column target = new Column(1); int value = 1; target.RemoveCandidate(value); Assert.AreEqual(false, target.HasACandidateFor(1)); }