コード例 #1
0
 public void TestGameboardOfDimention5AndPercentageOfMines20Has5Mines()
 {
     int size = 5;
     var fieldGenerator = new GameboardGenerator(RandomGenerator.Instance);
     IGameboard gameboard = fieldGenerator.Generate(size, 0.2);
     int numberOfMines = this.GetNumberOfMines(gameboard);
     bool numberOfMinesIs5 = numberOfMines == 5;
     Assert.IsTrue(numberOfMinesIs5, String.Format("Number of mines is {0}. Should be 5.", numberOfMines));
 }
コード例 #2
0
 public void TestGameboardOfDimention10AndPercentageOfMines30Has30Mines()
 {
     int size = 10;
     var fieldGenerator = new GameboardGenerator(RandomGenerator.Instance);
     IGameboard gameboard = fieldGenerator.Generate(size, 0.3);
     int numberOfMines = this.GetNumberOfMines(gameboard);
     bool numberOfMinesIs30 = numberOfMines == 30;
     Assert.IsTrue(numberOfMinesIs30, String.Format("Number of mines is {0}. Should be 30.", numberOfMines));
 }