public void TestClipboard() { 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_CONT_UP; grid[p1] = BimaruValue.SHIP_CONT_DOWN; backup.CloneToClipboard(grid); grid[p0] = BimaruValue.SHIP_SINGLE; grid[p1] = BimaruValue.WATER; backup.RestoreFromClipboardTo(grid); BimaruValue[,] expectedFieldValues; expectedFieldValues = new BimaruValue[1, 2] { { BimaruValue.SHIP_CONT_UP, BimaruValue.SHIP_CONT_DOWN } }; grid.AssertEqual(expectedFieldValues); }
public void TestRestoreClipBoardToNull() { var backup = new Backup <BimaruGrid>(); backup.CloneToClipboard(new BimaruGrid(1, 1)); Assert.ThrowsException <ArgumentNullException>(() => backup.RestoreFromClipboardTo(null)); }
public void TestCloneNullToClipboard() { var backup = new Backup <BimaruGrid>(); Assert.ThrowsException <ArgumentNullException>(() => backup.CloneToClipboard(null)); }