public void GetAllUnsetVariables_NoVariablesAreUnset_ReturnsEmptyCollection() { // Arrange var grid = new SudokuGrid(FullGrid()); // Act var unsetVariables = new List <Variable>(grid.GetAllUnsetVariables()); // Assert Assert.AreEqual(0, unsetVariables.Count); }
public void GetAllUnsetVariables_AllVariablesAreUnset_ReturnsAllVariables() { // Arrange var initialValues = EmptyGrid(); var grid = new SudokuGrid(initialValues); // Act var unsetVariables = new List <Variable>(grid.GetAllUnsetVariables()); // Assert Assert.AreEqual(initialValues.Cells, unsetVariables.Count); Assert.IsTrue(unsetVariables.All(v => !v.IsSet)); }
public void GetAllUnsetVariables_SomeVariablesAreUnset_ReturnsOnlyUnsetVariables() { // Arrange var initialValues = AnyInitialValues(); var grid = new SudokuGrid(initialValues); // Act var unsetVariables = new List <Variable>(grid.GetAllUnsetVariables()); // Assert int unsetCount = initialValues.Count(x => x == Variable.UNSET_VALUE); Assert.AreEqual(unsetCount, unsetVariables.Count); Assert.IsTrue(unsetVariables.All(v => !v.IsSet)); }