Esempio n. 1
0
        public void ValidateValues_success()
        {
            Animal animal = new Herbivour()
            {
                name = "Hippo",
                food = FoodType.Plants,
                size = BodySize.Big
            };

            bool valid = animal.ValidateValues();

            Assert.IsTrue(valid);
        }
Esempio n. 2
0
        public void ResetToDefault()
        {
            Animal animal = new Herbivour()
            {
                name = "Hippo",
                food = FoodType.Plants,
                size = BodySize.Big
            };

            animal.ResetToDefault();

            Assert.AreEqual("", animal.name);
            Assert.AreEqual(FoodType.Meat, animal.food);
            Assert.AreEqual(BodySize.Small, animal.size);
        }
Esempio n. 3
0
        public void CheckIfAllowedTest_Happy_Planteater_SmallerSize()
        {
            Animal animal = new Carnivour()
            {
                name = "Wolf",
                food = FoodType.Meat,
                size = BodySize.Medium
            };

            Animal newAnimal = new Herbivour()
            {
                name = "mice",
                food = FoodType.Plants,
                size = BodySize.Small
            };

            bool allowed = animal.CheckIfAllowed(newAnimal);

            Assert.IsFalse(allowed);
        }
Esempio n. 4
0
        public void CheckIfAllowedTest_Happy_Planteater_LargerSize()
        {
            IAnimal animal = new Carnivour()
            {
                name = "Wolf",
                food = FoodType.Meat,
                size = BodySize.Medium
            };

            IAnimal newAnimal = new Herbivour()
            {
                name = "Elephant",
                food = FoodType.Plants,
                size = BodySize.Big
            };

            bool allowed = animal.CheckIfAllowed(newAnimal);

            Assert.IsTrue(allowed);
        }