示例#1
0
    public void deleteRegionsButTheBiggest_withTwoRegions()
    {
        RectShape shape = new RectShape(new Cell(0, 0), new OIGrid(10, 10));

        //REG 1
        shape.setCellValue(1, 1, XTile.FLOOR);
        //REG 2s
        shape.setCellValue(3, 1, XTile.FLOOR);
        shape.setCellValue(3, 2, XTile.FLOOR);
        shape.setCellValue(3, 3, XTile.FLOOR);
        Assert.AreEqual(2, shape.regionsNumber());

        shape.deleteRegionsButTheBiggest();
        Assert.AreEqual(1, shape.regionsNumber());

        Assert.IsTrue(shape.hasCellValue(1, 1, XTile.WALL));
        Assert.IsTrue(shape.hasCellValue(3, 1, XTile.FLOOR));
        Assert.IsTrue(shape.hasCellValue(3, 2, XTile.FLOOR));
        Assert.IsTrue(shape.hasCellValue(3, 3, XTile.FLOOR));
    }