public void Cant_Add_Animals_To_Full_Wagon()
        {
            Wagon  wagon      = new Wagon();
            Animal herbivore1 = new Animal("Big Herbivore1", AnimalSize.Large, AnimalType.Herbivore);
            Animal herbivore2 = new Animal("Big Herbivore2", AnimalSize.Large, AnimalType.Herbivore);
            Animal herbivore3 = new Animal("Big Herbivore3", AnimalSize.Large, AnimalType.Herbivore);

            wagon.AddAnimalToWagon(herbivore1);
            wagon.AddAnimalToWagon(herbivore2);
            wagon.AddAnimalToWagon(herbivore3);


            bool DoesAnimalFitInWagon()
            {
                if (wagon.MaxCapacity > 10)
                {
                    return(false);
                }

                return(true);
            }

            //Assert
            Assert.IsTrue(DoesAnimalFitInWagon());
        }
Ejemplo n.º 2
0
        public void AddAnimalToWagon_Add2LargeHerbivores_True()
        {
            Wagon  wagon   = new Wagon();
            Animal animal1 = new Animal(0, "", Diet.Herbivore, Size.Large);
            Animal animal2 = new Animal(0, "", Diet.Herbivore, Size.Large);


            wagon.AddAnimalToWagon(animal1);
            wagon.AddAnimalToWagon(animal2);

            Assert.AreEqual(wagon.GetAnimals().Count(), 2);
        }
Ejemplo n.º 3
0
        public void When_Animal_Is_Added_UsedSize_Is_Higher()
        {
            //Arrange
            Animal a            = new Animal(Size.Large, Sort.Herbivore, "Giraffe");
            int    wagonSize    = _wagon.UsedSize;
            int    expectedSize = wagonSize + 5;

            //Act
            _wagon.AddAnimalToWagon(a);

            //Assert
            Assert.AreEqual(expectedSize, _wagon.UsedSize);
        }
        public void Cant_Add_Herbivore_With_Same_Size_Or_Bigger_Carnivore()
        {
            //Arrange
            Wagon  wagon     = new Wagon();
            Animal carnivore = new Animal("Tijger", AnimalSize.Medium, AnimalType.Carnivore);
            Animal herbivore = new Animal("Paard", AnimalSize.Medium, AnimalType.Herbivore);

            //Act
            wagon.AddAnimalToWagon(carnivore);

            //Assert
            Assert.IsFalse(wagon.AddAnimalToWagon(herbivore));
        }
Ejemplo n.º 5
0
        public void AddToWagon_LargeAnimal_CapacityIs5()
        {
            //Arrange:
            _animal = new Animal()
            {
                Diet = Diet.Herbivore, Size = Size.Large
            };

            //Act:
            _wagon.AddAnimalToWagon(_animal);

            //Assert:
            Assert.AreEqual(5, _wagon.Capacity);
        }
        public void When_Animal_Is_Added_Capacity_Is_Lower()
        {
            //Arrange
            Wagon  wagon  = new Wagon();
            Animal animal = new Animal("AAP", AnimalSize.Large, AnimalType.Carnivore);

            //Act
            int originalCapacity = wagon.MaxCapacity;
            int animalSize       = (int)animal.Size;
            int expectedCapacity = originalCapacity - animalSize;

            wagon.AddAnimalToWagon(animal);

            //Assert
            Assert.AreEqual(expectedCapacity, wagon.Capacity);
        }
Ejemplo n.º 7
0
        public void AddAnimalToWagon_Add11SmallHerb_False()
        {
            Animal Smallherb = new Animal(0, "", Diet.Herbivore, Size.Small);
            Wagon  wagon     = new Wagon();

            bool passed = true;

            for (int i = 0; i <= 10; i++)
            {
                if (!wagon.AddAnimalToWagon(Smallherb))
                {
                    passed = false;
                }
            }

            Assert.IsFalse(passed);
        }
Ejemplo n.º 8
0
        public void AddAnimalToWagon_Add3LargeHerbivore_False()
        {
            Wagon wagon = new Wagon();

            bool passed = true;

            for (int i = 0; i <= 2; i++)
            {
                if (!wagon.AddAnimalToWagon(new Animal(0, "", Diet.Herbivore, Size.Large)))
                {
                    passed = false;
                }
                ;
            }

            Assert.IsFalse(passed);
        }
Ejemplo n.º 9
0
        public void Test_AddingAnimalThatDoesntFitThrowsException()
        {
            Wagon wagon = new Wagon();

            wagon.animalsInWagon = new List <Animal>()
            {
                new Animal(Diet.Carnivore, Size.Large)
            };
            bool caught = false;

            try
            {
                wagon.AddAnimalToWagon(new Animal(Diet.Carnivore, Size.Small));
            }
            catch (Exception e)
            {
                caught = true;
            }
            Assert.IsTrue(caught);
        }