public void WaterholeCanNotBeEatenByPredatorNoFood()
        {
            var wateringhole = new WateringHole();
            var species      = new MockSpecies();

            species.IsPredator = true;
            Assert.IsFalse(wateringhole.CanBeEatenBy(species));
            Assert.AreEqual(0, wateringhole.FoodAmount);
        }
        public void WaterHoleThrowsExceptionIfEatIsEmptyAndPredator()
        {
            var wateringhole = new WateringHole();
            var species      = new MockSpecies();

            species.IsPredator = true;
            Assert.ThrowsException <InvalidOperationException>(() => wateringhole.Eat(species));
            Assert.AreEqual(0, wateringhole.FoodAmount);
        }
        public void WaterholeCanBeEatenByNoPredatorWithFood()
        {
            var wateringhole = new WateringHole();
            var species      = new MockSpecies();

            species.IsPredator = false;
            wateringhole.AddFood(10);
            Assert.IsTrue(wateringhole.CanBeEatenBy(species));
            Assert.AreEqual(10, wateringhole.FoodAmount);
        }
        public void WaterHoleEatCannotEatAsPredator()
        {
            var wateringhole = new WateringHole();
            var species      = new MockSpecies();

            species.IsPredator = true;
            wateringhole.AddFood(10);
            Assert.ThrowsException <InvalidOperationException>(() => wateringhole.Eat(species));
            Assert.AreEqual(10, wateringhole.FoodAmount);
        }
        public void WaterHoleCannotTryEatIfHoleIsEmpty()
        {
            var wateringhole = new WateringHole();
            var species      = new MockSpecies();

            species.IsPredator = false;
            var result = wateringhole.TryEat(species, out int food);

            Assert.AreEqual(0, food);
            Assert.IsFalse(result);
            Assert.AreEqual(0, wateringhole.FoodAmount);
        }
        public void WaterHoleEatCanEat()
        {
            var wateringhole = new WateringHole();
            var species      = new MockSpecies();

            species.IsPredator = false;
            wateringhole.AddFood(10);
            var result = wateringhole.Eat(species);

            Assert.AreEqual(9, wateringhole.FoodAmount);
            Assert.AreEqual(1, result);
        }
        public void WaterHoleTryEatCanEat()
        {
            var wateringhole = new WateringHole();
            var species      = new MockSpecies();

            species.IsPredator = false;
            wateringhole.AddFood(10);
            Assert.AreEqual(10, wateringhole.FoodAmount);
            var result = wateringhole.TryEat(species, out int food);

            Assert.AreEqual(1, food);
            Assert.AreEqual(9, wateringhole.FoodAmount);
            Assert.IsTrue(result);
        }