public static void AssertEqual(this IBimaruGrid actualGrid, BimaruValue[,] expectedFieldValues) { foreach (var p in actualGrid.AllPoints()) { Assert.AreEqual(expectedFieldValues[p.RowIndex, p.ColumnIndex], actualGrid[p]); } }
private void FireInitialChangedEvents(IBimaruGrid grid, EventHandler <FieldValueChangedEventArgs <BimaruValue> > eventHandler) { foreach (GridPoint p in grid.AllPoints().Where(p => grid[p] != BimaruValue.UNDETERMINED)) { eventHandler(this, new FieldValueChangedEventArgs <BimaruValue>(p, BimaruValue.UNDETERMINED)); } }
public static void AssertEqual(this IBimaruGrid expectedGrid, IBimaruGrid actualGrid) { Assert.AreEqual(expectedGrid.NumberOfRows, actualGrid.NumberOfRows); Assert.AreEqual(expectedGrid.NumberOfColumns, actualGrid.NumberOfColumns); foreach (var p in expectedGrid.AllPoints()) { Assert.AreEqual(expectedGrid[p], actualGrid[p]); } Assert.IsTrue(expectedGrid.NumberOfUndeterminedFieldsPerColumn.SequenceEqual(actualGrid.NumberOfUndeterminedFieldsPerColumn)); Assert.IsTrue(expectedGrid.NumberOfUndeterminedFieldsPerRow.SequenceEqual(actualGrid.NumberOfUndeterminedFieldsPerRow)); Assert.IsTrue(expectedGrid.NumberOfShipFieldsPerColumn.SequenceEqual(actualGrid.NumberOfShipFieldsPerColumn)); Assert.IsTrue(expectedGrid.NumberOfShipFieldsPerRow.SequenceEqual(actualGrid.NumberOfShipFieldsPerRow)); Assert.IsTrue(expectedGrid.NumberOfShipsPerLength.SequenceEqual(actualGrid.NumberOfShipsPerLength)); Assert.AreEqual(expectedGrid.IsValid, actualGrid.IsValid); Assert.AreEqual(expectedGrid.IsFullyDetermined, actualGrid.IsFullyDetermined); }