Пример #1
0
        public void LegalToAddExceedCapicity()
        {
            Wagon wagon = new Wagon();

            Herbivore herbivore = new Herbivore(AnimalEnums.AnimalSize.Large);


            wagon.AddToWagon(herbivore);
            wagon.AddToWagon(herbivore);

            bool actual = wagon.LegalToAdd(herbivore);

            Assert.IsFalse(actual);
        }
Пример #2
0
        public void CheckCompatibilityTrueTest2()
        {
            //arrange
            //By giving the wagon a huge capacity we can safely bypass the weight test and will only have to pass the compatibility test.
            //This test will check if we can add a smaller carnivore to a wagon with a larger herbivore.
            Wagon  wagon   = new Wagon(100, false);
            Animal animal  = new Animal("test", Size.Large, typeAnimal.Herbivore);
            Animal animal2 = new Animal("test", Size.Medium, typeAnimal.Carnivore);

            //act
            wagon.AddToWagon(animal);
            bool test = wagon.AddToWagon(animal2);

            //assert
            Assert.IsTrue(test);
        }
Пример #3
0
        public void CheckCompatibilityFalseTest2()
        {
            //arrange
            //By giving the wagon a huge capacity we can safely bypass the weight test and will only have to pass the compatibility test.
            //This test will check if the method prevents a carnivore and herbivore of the same size being added to the same wagon
            Wagon  wagon   = new Wagon(100, false);
            Animal animal  = new Animal("test", Size.Large, typeAnimal.Carnivore);
            Animal animal2 = new Animal("test", Size.Large, typeAnimal.Herbivore);

            //act
            wagon.AddToWagon(animal);
            bool test = wagon.AddToWagon(animal2);

            //assert
            Assert.IsFalse(test);
        }
Пример #4
0
        public void CheckCompatibilityFalse()
        {
            //Arrange
            //Door de wagon een enorme capaciteit te geven, kunnen we de gewichtstest veilig omzeilen en hoeven we alleen de compatibiliteitstest te doorstaan.
            //Deze test controleert of de methode voorkomt dat een kleinere PlantenEter wordt toegevoegd aan een wagon met een grotere VleesEter.
            Wagon  wagon   = new Wagon(100, false);
            Animal animal  = new Animal("test", GrootteTypes.Groot, AnimalTypes.VleesEter);
            Animal animal2 = new Animal("test", GrootteTypes.Middelgroot, AnimalTypes.PlantenEter);

            //Act
            wagon.AddToWagon(animal);
            bool test = wagon.AddToWagon(animal2);

            //Assert
            Assert.IsFalse(test);
        }
Пример #5
0
        public void CheckWeightFalseTrue()
        {
            //arrange
            //By leaving the wagon empty the compatibility test will automatically pass so this will only focus on the weight test
            Wagon  wagon  = new Wagon(4, false);
            Animal animal = new Animal("test", Size.Large, typeAnimal.Herbivore);
            //act
            bool test = wagon.AddToWagon(animal);

            //assert
            Assert.IsFalse(test);
        }
Пример #6
0
        public void CheckWeightFalseIsTrue()
        {
            //Arrange
            Wagon  wagon  = new Wagon(4, false);
            Animal animal = new Animal("test", GrootteTypes.Groot, AnimalTypes.PlantenEter);

            //Act
            bool test = wagon.AddToWagon(animal);

            //Assert
            Assert.IsFalse(test);
        }
Пример #7
0
        public void CheckWeightIsTrue()
        {
            //Arrange
            //Door de wagen leeg te laten zal de compatibiliteitstest automatisch slagen, dus dit zal alleen gericht zijn op de gewichtstest
            Wagon  wagon  = new Wagon(6, false);
            Animal animal = new Animal("test", GrootteTypes.Groot, AnimalTypes.PlantenEter);
            //Act
            bool test = wagon.AddToWagon(animal);

            //Assert
            Assert.IsTrue(test);
        }
Пример #8
0
        public void LegalToAddDoubleCarnivores()
        {
            Wagon wagon = new Wagon();

            Carnivore carnivore = new Carnivore(AnimalEnums.AnimalSize.Small);

            wagon.AddToWagon(carnivore);

            bool actual = wagon.LegalToAdd(carnivore);

            Assert.IsFalse(actual);
        }
Пример #9
0
        public void AddOneToWagonTest()
        {
            //arrange
            Wagon  wagon  = new Wagon(10, false);
            Animal animal = new Animal("test", Size.Small, typeAnimal.Herbivore);

            //act
            wagon.AddToWagon(animal);
            int count = wagon.AnimalsInWagon.Count();

            //assert
            Assert.AreEqual(1, count);
        }
Пример #10
0
        public void AddAnimalToWagon()
        {
            //Arrange
            Wagon  wagon  = new Wagon(10, false);
            Animal animal = new Animal("test", GrootteTypes.Klein, AnimalTypes.VleesEter);

            //Act
            wagon.AddToWagon(animal);
            int count = wagon.AnimalToWagon.Count();

            //Assert
            Assert.AreEqual(1, count);
        }
Пример #11
0
        public void LegalToAddLargerCarnivoreByHerbivore()
        {
            Wagon wagon = new Wagon();

            Herbivore herbivore = new Herbivore(AnimalEnums.AnimalSize.Small);
            Carnivore carnivore = new Carnivore(AnimalEnums.AnimalSize.Medium);

            wagon.AddToWagon(herbivore);

            bool actual = wagon.LegalToAdd(carnivore);

            Assert.IsFalse(actual);
        }
Пример #12
0
 public void SameSizeAnimals()
 {
     wagon.AddToWagon(lion);
     Assert.IsFalse(giraffe.IsSafe(wagon.Animals));
 }