Exemple #1
0
            public void AddAnimal_ShouldWork(Size size, FoodPreference foodPreference)
            {
                // Arrange
                int    expected        = 2;
                Wagon  wagon           = new Wagon();
                Animal bigCarnivore    = new Animal(Size.Large, FoodPreference.Herbivore);
                Animal mediumHerbivore = new Animal(size, foodPreference);

                // Act
                wagon.IsAnimalAdded(bigCarnivore);
                wagon.IsAnimalAdded(mediumHerbivore);
                int result = wagon.Animals.Count;

                // Assert
                Assert.Equal(expected, result);
                Assert.Equal(bigCarnivore, wagon.Animals[0]);
            }
Exemple #2
0
            public void AddAnimal_ShouldFail(Size firstAnimalSize, FoodPreference firstFoodPreference, Size secAnimalSize, FoodPreference secFoodPreference)
            {
                // Arrange
                int    expected     = 1;
                Wagon  wagon        = new Wagon();
                Animal firstAnimal  = new Animal(firstAnimalSize, firstFoodPreference);
                Animal secondAnimal = new Animal(secAnimalSize, secFoodPreference);

                // Act
                wagon.IsAnimalAdded(firstAnimal);
                wagon.IsAnimalAdded(secondAnimal);
                int result = wagon.Animals.Count;

                // Assert
                Assert.Equal(expected, result);
                Assert.Equal(firstAnimal, wagon.Animals[0]);
            }
Exemple #3
0
            public void AddAnimal_ShouldNotAddEmptyClassAndReturnFalse()
            {
                // Arrange
                int expected = 0;

                // Act
                bool isAdded = wagon.IsAnimalAdded(emptyAnimal);
                int  result  = wagon.Animals.Count;

                // Assert
                Assert.Equal(expected, result);
                Assert.False(isAdded);
            }
Exemple #4
0
            public void AddAnimal_ShouldWorkAndReturnTrue()
            {
                // Arrange
                int    expected = 1;
                Wagon  wagon    = new Wagon();
                Animal animal   = new Animal(Size.Large, FoodPreference.Carnivore);

                // Act
                bool isAdded = wagon.IsAnimalAdded(animal);
                int  result  = wagon.Animals.Count;

                // Assert
                Assert.Equal(expected, result);
                Assert.Equal(animal, wagon.Animals[0]);
                Assert.True(isAdded);
            }