public void GeneratorThrowsExceptionWhenMapIsTooSmallForAllBombs(int bombsAmount, int width, int height) { BombGenerator bombGenerator = new BombGenerator(); Map map = GenerateEmptyMap(width, height, bombsAmount); Exception ex = Assert.Throws <Exception>(() => bombGenerator.GenerateBombs(map)); Assert.NotNull(ex); }
public void GeneratorGeneratesExaclyAsManyBombsAsRequested(int bombsAmount, int width, int height) { BombGenerator bombGenerator = new BombGenerator(); Map map = GenerateEmptyMap(width, height, bombsAmount); Map generatedMap = bombGenerator.GenerateBombs(map); Assert.Equal(bombsAmount, HowManyBombsDoesMapHave(generatedMap)); }
public void GeneratorDoesNotGenerateBombsWhichAreSurroundedByOtherBombs() { int bombsAmount = 8, width = 3, height = 3; BombGenerator bombGenerator = new BombGenerator(); Map map = GenerateEmptyMap(width, height, bombsAmount); for (int i = 0; i < 2; i++) { Map generatedMap = bombGenerator.GenerateBombs(map); Assert.False(IsAnyBombSurroundedByOtherBombs(generatedMap)); } }