public void WateringHoleConstructionStartsEmpty()
        {
            var wateringhole = new WateringHole();

            int expectedCount = 0;
            var actualCount   = wateringhole.FoodAmount;

            Assert.AreEqual(expectedCount, actualCount);
        }
        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 WaterHoleAddFoodCannotDecreaseFoodAmountBeyond0()
        {
            var wateringhole = new WateringHole();

            wateringhole.AddFood(10);

            Assert.AreEqual(10, wateringhole.FoodAmount);

            wateringhole.AddFood(-20);

            Assert.AreEqual(0, wateringhole.FoodAmount);
        }
        public void WaterHoleAddFoodDecreasesFoodAmountWhenNegativeValueIsAdded()
        {
            var wateringhole = new WateringHole();

            wateringhole.AddFood(10);

            Assert.AreEqual(10, wateringhole.FoodAmount);

            wateringhole.AddFood(-5);

            Assert.AreEqual(5, wateringhole.FoodAmount);
        }
        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);
        }
        public void WateringHoleAddFoodIncreasesFoodAmount()
        {
            var wateringhole = new WateringHole();

            Assert.AreEqual(0, wateringhole.FoodAmount);

            wateringhole.AddFood(10);

            Assert.AreEqual(10, wateringhole.FoodAmount);

            wateringhole.AddFood(20);

            Assert.AreEqual(30, wateringhole.FoodAmount);
        }