public void TakeFoodIsFalseTest() { var eatMatrix = new FoodMatrix(2, 2, new FillingFromCornersByWavesStrategy()); var point = new Point(0, 0); Assert.IsFalse(eatMatrix.TakeFood(point)); }
public void Eat(FoodMatrix eatMatrix) { if (eatMatrix.TakeFood(Position)) { _energyPoints += CreatureConstants.OneBite; } }
public void TakeFoodIsTrueTest() { var eatMatrix = new FoodMatrix(2, 2, new FillingFromCornersByWavesStrategy()); var point = new Point(0, 0); FrequentlyUsedMethods.RaiseFoodLevelToConstantWithAddFood(eatMatrix, point, CreatureConstants.OneBite); Assert.IsTrue(eatMatrix.HasOneBite(point)); var counter = FoodMatrixConstants.AddedFoodLevel / CreatureConstants.OneBite; for (int i = 0; i < counter; i++) { Assert.IsTrue(eatMatrix.TakeFood(point)); } Assert.IsFalse(eatMatrix.HasOneBite(point)); }