public void TestStackOperations() { var backup = new Backup <BimaruGrid>(); var grid = new BimaruGrid(1, 2); var p0 = new GridPoint(0, 0); var p1 = new GridPoint(0, 1); grid[p0] = BimaruValue.SHIP_SINGLE; grid[p1] = BimaruValue.WATER; backup.SetSavePoint(grid); grid[p0] = BimaruValue.SHIP_CONT_DOWN; grid[p1] = BimaruValue.UNDETERMINED; backup.RestoreAndDeleteLastSavepoint(grid); BimaruValue[,] expectedFieldValues = new BimaruValue[1, 2] { { BimaruValue.SHIP_SINGLE, BimaruValue.WATER } }; grid.AssertEqual(expectedFieldValues); AssertEmptyStack(backup); }
public void TestSetSavePointNull() { var stack = new Backup <BimaruGrid>(); Assert.ThrowsException <ArgumentNullException>(() => stack.SetSavePoint(null)); }