public void GetFoodPrice_When_Invalid_Weight_Throws_Exception()
        {
            // Arrange

            var specie = new Herbivore {
                Specie = AnimalSpecieNames.Giraffe, Rate = 0.5, PricePerKg = 2
            };


            // Act, Assert
            Assert.Throws <ArgumentException>(() => specie.GetFoodPrice(-100));
        }
Beispiel #2
0
 /// <summary>
 /// Calculates the food price.
 /// </summary>
 /// <param name="weight">the animal weight</param>
 /// <returns>The food price</returns>
 public override double GetFoodPrice(double weight)
 {
     // Price of meat * % + Price of fruit * (1-%)
     _herbivore.PricePerKg = FruitPricePerKg;
     return((base.GetFoodPrice(weight) * MeatPercentage) + (_herbivore.GetFoodPrice(weight) * (1 - MeatPercentage)));
 }