Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void TestRestoreClipBoardToNull()
        {
            var backup = new Backup <BimaruGrid>();

            backup.CloneToClipboard(new BimaruGrid(1, 1));

            Assert.ThrowsException <ArgumentNullException>(() => backup.RestoreFromClipboardTo(null));
        }
Exemplo n.º 3
0
        public void TestCloneNullToClipboard()
        {
            var backup = new Backup <BimaruGrid>();

            Assert.ThrowsException <ArgumentNullException>(() => backup.CloneToClipboard(null));
        }