public void BuildTest() { var frequency = 10; var eatMatrix = new FoodMatrix(2, 2, new FillingOfEntireFieldStrategy(frequency)); var creatures = new bool[2, 2]; for (int k = 0; k < 10; k++) { if (k != 9 && FoodMatrixConstants.AddedFoodLevel <= FoodMatrixConstants.MaxFoodLevel) { eatMatrix.Build(creatures); for (int i = 0; i < eatMatrix.Length; i++) { for (int j = 0; j < eatMatrix.Height; j++) { Assert.IsFalse(eatMatrix.HasMaxFoodLevel(new Point(i, j))); } } } if (k == 9) { FrequentlyUsedMethods.RaiseFoodLevelToConstantWithBuild(eatMatrix, creatures, FoodMatrixConstants.MaxFoodLevel, frequency); for (int i = 0; i < eatMatrix.Length; i++) { for (int j = 0; j < eatMatrix.Height; j++) { Assert.IsTrue(eatMatrix.HasMaxFoodLevel(new Point(i, j))); } } } } }
public void BuildWithOneFreeCellTest() { var eatMatrix = new FoodMatrix(2, 2, new FillingFromCornersByWavesStrategy()); var creatures = new bool[2, 2]; creatures[0, 0] = true; creatures[0, 1] = true; creatures[1, 0] = true; FrequentlyUsedMethods.RaiseFoodLevelToConstantWithBuild(eatMatrix, creatures, FoodMatrixConstants.MaxFoodLevel, 1); Assert.IsTrue(eatMatrix.HasMaxFoodLevel(new Point(1, 1))); }