Пример #1
0
        public void DoesAnimalHaveASpotTest4()
        {
            CircusTrein.Train         train   = new CircusTrein.Train();
            List <CircusTrein.Animal> animals = new List <Animal>();

            // Arrange
            train.AddAnimalToQueue(MockAnimals.testAnimals[0]);
            train.AddAnimalToQueue(MockAnimals.testAnimals[4]);
            train.AddAnimalToQueue(MockAnimals.testAnimals[6]);
            train.AddAnimalToQueue(MockAnimals.testAnimals[6]);
            animals.Add(MockAnimals.testAnimals[6]);
            animals.Add(MockAnimals.testAnimals[6]);
            animals.Add(MockAnimals.testAnimals[4]);
            animals.Add(MockAnimals.testAnimals[0]);

            List <Animal> actualAnimals = new List <Animal>();

            train.InsertAnimalsToWagon();

            foreach (var wagon in train.RetrieveWagons())
            {
                foreach (var animal in wagon.RetrieveAnimals())
                {
                    actualAnimals.Add(animal);
                }
            }

            CollectionAssert.AreEqual(animals, actualAnimals);
            Assert.AreEqual(2, train.RetrieveWagons().Count);
        }
Пример #2
0
        public void DoesAnimalHaveASpotTest3()
        {
            CircusTrein.Train         train   = new CircusTrein.Train();
            List <CircusTrein.Animal> animals = new List <Animal>();

            // Arrange
            train.AddAnimalToQueue(MockAnimals.testAnimals[0]);
            train.AddAnimalToQueue(MockAnimals.testAnimals[4]);
            train.AddAnimalToQueue(MockAnimals.testAnimals[6]);
            animals.Add(MockAnimals.testAnimals[6]);
            animals.Add(MockAnimals.testAnimals[4]);
            animals.Add(MockAnimals.testAnimals[0]);
            List <CircusTrein.Animal> actualList = new List <Animal>();

            // Act
            train.InsertAnimalsToWagon();
            var actualValue = train.RetrieveWagons();

            foreach (var wagon in actualValue)
            {
                actualList = wagon.RetrieveAnimals();
            }

            // Assert
            CollectionAssert.AreEqual(animals, actualList);
            Assert.AreEqual(1, train.RetrieveWagons().Count);
        }
Пример #3
0
            static void Keuze_3()
            {
                Train train = new Train();

                Console.WriteLine("U heeft gekozen voor gemengd");
                Console.WriteLine("Voer een naam in");
                string name   = Console.ReadLine();
                Animal animal = new Animal(name, AnimalSize.Large, AnimalDiet.Herbivore);

                Console.WriteLine("Voer een grootte in, kies uit 'small', 'medium', 'large'");
                string size = Console.ReadLine();

                if (size == "small")
                {
                    animal.Size = AnimalSize.Small;
                    Console.WriteLine("Voer een dieet in, kies uit 'vlees' of 'planten'");
                    string dieet = Console.ReadLine();
                    if (dieet == "vlees")
                    {
                        animal.Diet = AnimalDiet.Carnivore;
                        train.AddAnimalToQueue(animal);
                        doesUserWantToAddMoreAnimals = true;
                        while (doesUserWantToAddMoreAnimals == true)
                        {
                            Console.WriteLine("Wil je nog meer dieren toevoegen? Antwoord 'ja'/'nee'");
                            doesUserWantToAddMoreAnimals = false;
                            string antwoord = Console.ReadLine();
                            if (antwoord == "ja")
                            {
                                doesUserWantToSeeTheMenu = true;
                            }
                            if (antwoord == "nee")
                            {
                                doesUserWantToSeeTheMenu = false;
                                train.InsertAnimalsToWagon();
                                List <Wagon> wagons = train.RetrieveWagons();
                                for (int i = 0; i < wagons.Count; i++)
                                {
                                    Console.WriteLine("Wagon" + (i + 1));
                                    foreach (Animal animalTest in wagons[i].RetrieveAnimals())
                                    {
                                        Console.WriteLine("IK KOM HIER AAN");
                                        Console.WriteLine(animalTest.Name + animalTest.Diet + animalTest.Size);
                                    }
                                }
                            }
                            else if (antwoord != "ja" && antwoord != "nee")
                            {
                                Console.WriteLine("Onjuiste invoer");
                                doesUserWantToAddMoreAnimals = true;
                            }
                        }
                    }
                    if (dieet == "planten")
                    {
                        animal.Diet = AnimalDiet.Herbivore;
                        Console.ReadLine();
                        doesUserWantToAddMoreAnimals = true;
                        while (doesUserWantToAddMoreAnimals == true)
                        {
                            Console.WriteLine("Wil je nog meer dieren toevoegen? Antwoord 'ja'/'nee'");
                            doesUserWantToAddMoreAnimals = false;
                            string antwoord = Console.ReadLine();
                            if (antwoord == "ja")
                            {
                                doesUserWantToSeeTheMenu = true;
                            }
                            if (antwoord == "nee")
                            {
                                doesUserWantToSeeTheMenu = false;
                                train.InsertAnimalsToWagon();
                                List <Wagon> wagons = train.RetrieveWagons();
                                for (int i = 0; i < wagons.Count; i++)
                                {
                                    Console.WriteLine("Wagon" + (i + 1));
                                    foreach (Animal animalTest in wagons[i].RetrieveAnimals())
                                    {
                                        Console.WriteLine(animalTest.Name + animalTest.Diet + animalTest.Size);
                                    }
                                }
                            }
                            else if (antwoord != "ja" && antwoord != "nee")
                            {
                                Console.WriteLine("Onjuiste invoer");
                                doesUserWantToAddMoreAnimals = true;
                            }
                        }
                    }
                }
                if (size == "medium")
                {
                    animal.Size = AnimalSize.Medium;
                    Console.WriteLine("Voer een dieet in, kies uit 'vlees' of 'planten'");
                    string dieet = Console.ReadLine();
                    if (dieet == "vlees")
                    {
                        animal.Diet = AnimalDiet.Carnivore;
                        train.AddAnimalToQueue(animal);
                        doesUserWantToAddMoreAnimals = true;
                        while (doesUserWantToAddMoreAnimals == true)
                        {
                            Console.WriteLine("Wil je nog meer dieren toevoegen? Antwoord 'ja'/'nee'");
                            doesUserWantToAddMoreAnimals = false;
                            string antwoord = Console.ReadLine();
                            if (antwoord == "ja")
                            {
                                doesUserWantToSeeTheMenu = true;
                            }
                            if (antwoord == "nee")
                            {
                                doesUserWantToSeeTheMenu = false;
                                train.InsertAnimalsToWagon();
                                List <Wagon> wagons = train.RetrieveWagons();
                                for (int i = 0; i < wagons.Count; i++)
                                {
                                    Console.WriteLine("Wagon" + (i + 1));
                                    foreach (Animal animalTest in wagons[i].RetrieveAnimals())
                                    {
                                        Console.WriteLine(animalTest.Name + animalTest.Diet + animalTest.Size);
                                    }
                                }
                            }
                            else if (antwoord != "ja" && antwoord != "nee")
                            {
                                Console.WriteLine("Onjuiste invoer");
                                doesUserWantToAddMoreAnimals = true;
                            }
                        }
                    }
                    if (dieet == "planten")
                    {
                        animal.Diet = AnimalDiet.Herbivore;
                        train.AddAnimalToQueue(animal);
                        doesUserWantToAddMoreAnimals = true;
                        while (doesUserWantToAddMoreAnimals == true)
                        {
                            Console.WriteLine("Wil je nog meer dieren toevoegen? Antwoord 'ja'/'nee'");
                            doesUserWantToAddMoreAnimals = false;
                            string antwoord = Console.ReadLine();
                            if (antwoord == "ja")
                            {
                                doesUserWantToSeeTheMenu = true;
                            }
                            if (antwoord == "nee")
                            {
                                doesUserWantToSeeTheMenu = false;
                                train.InsertAnimalsToWagon();
                                List <Wagon> wagons = train.RetrieveWagons();
                                for (int i = 0; i < wagons.Count; i++)
                                {
                                    Console.WriteLine("Wagon" + (i + 1));
                                    foreach (Animal animalTest in wagons[i].RetrieveAnimals())
                                    {
                                        Console.WriteLine(animalTest.Name + animalTest.Diet + animalTest.Size);
                                    }
                                }
                            }
                            else if (antwoord != "ja" && antwoord != "nee")
                            {
                                Console.WriteLine("Onjuiste invoer");
                                doesUserWantToAddMoreAnimals = true;
                            }
                        }
                    }
                }
                if (size == "large")
                {
                    animal.Size = AnimalSize.Large;
                    Console.WriteLine("Voer een dieet in, kies uit 'vlees' of 'planten'");
                    string dieet = Console.ReadLine();
                    if (dieet == "vlees")
                    {
                        animal.Diet = AnimalDiet.Carnivore;
                        train.AddAnimalToQueue(animal);
                        doesUserWantToAddMoreAnimals = true;
                        while (doesUserWantToAddMoreAnimals == true)
                        {
                            Console.WriteLine("Wil je nog meer dieren toevoegen? Antwoord 'ja'/'nee'");
                            doesUserWantToAddMoreAnimals = false;
                            string antwoord = Console.ReadLine();
                            if (antwoord == "ja")
                            {
                                doesUserWantToSeeTheMenu = true;
                            }
                            if (antwoord == "nee")
                            {
                                doesUserWantToSeeTheMenu = false;
                                train.InsertAnimalsToWagon();
                                List <Wagon> wagons = train.RetrieveWagons();
                                for (int i = 0; i < wagons.Count; i++)
                                {
                                    Console.WriteLine("Wagon" + (i + 1));
                                    foreach (Animal animalTest in wagons[i].RetrieveAnimals())
                                    {
                                        Console.WriteLine(animalTest.Name + animalTest.Diet + animalTest.Size);
                                    }
                                }
                            }
                            else if (antwoord != "ja" && antwoord != "nee")
                            {
                                Console.WriteLine("Onjuiste invoer");
                                doesUserWantToAddMoreAnimals = true;
                            }
                        }
                    }
                    if (dieet == "planten")
                    {
                        animal.Diet = AnimalDiet.Herbivore;
                        train.AddAnimalToQueue(animal);
                        doesUserWantToAddMoreAnimals = true;
                        while (doesUserWantToAddMoreAnimals == true)
                        {
                            Console.WriteLine("Wil je nog meer dieren toevoegen? Antwoord 'ja'/'nee'");
                            doesUserWantToAddMoreAnimals = false;
                            string antwoord = Console.ReadLine();
                            if (antwoord == "ja")
                            {
                                doesUserWantToSeeTheMenu = true;
                            }
                            if (antwoord == "nee")
                            {
                                doesUserWantToSeeTheMenu = false;
                                train.InsertAnimalsToWagon();
                                List <Wagon> wagons = train.RetrieveWagons();
                                for (int i = 0; i < wagons.Count; i++)
                                {
                                    Console.WriteLine("Wagon" + (i + 1));
                                    foreach (Animal animalTest in wagons[i].RetrieveAnimals())
                                    {
                                        Console.WriteLine(animalTest.Name + animalTest.Diet + animalTest.Size);
                                    }
                                }
                            }
                            else if (antwoord != "ja" && antwoord != "nee")
                            {
                                Console.WriteLine("Onjuiste invoer");
                                doesUserWantToAddMoreAnimals = true;
                            }
                        }
                    }
                }
            }
Пример #4
0
            static void Keuze_3()
            {
                bool  loop  = true;
                Train train = new Train();

                while (loop == true)
                {
                    Console.WriteLine("U heeft gekozen voor gemengd");
                    Console.WriteLine("Voer een naam in");
                    string  name   = Console.ReadLine();
                    Animals animal = new Animals(name, AnimalSize.Large, AnimalDiet.Herbivore);
                    Console.WriteLine("Voer een grootte in, kies uit 'small', 'medium', 'large'");
                    string size = Console.ReadLine();
                    if (size == "small")
                    {
                        animal.Size = AnimalSize.Small;
                        Console.WriteLine("Voer een dieet in, kies uit 'vlees' of 'planten'");
                        string dieet = Console.ReadLine();
                        if (dieet == "vlees")
                        {
                            animal.Diet = AnimalDiet.Carnivore;
                            Console.ReadLine();
                            train.AddAnimalToQueue(animal);
                            train.InsertAnimalsToWagon();
                            List <Wagon> wagons = train.RetrieveWagons();
                            for (int i = 0; i < wagons.Count; i++)
                            {
                                Console.WriteLine("Wagon" + (i + 1));
                                foreach (Animals animalTest in wagons[i].RetrieveAnimals())
                                {
                                    Console.WriteLine(animalTest.Name + animalTest.Diet + animalTest.Size);
                                }
                            }
                        }
                        if (dieet == "planten")
                        {
                            animal.Diet = AnimalDiet.Herbivore;
                            Console.ReadLine();
                            train.AddAnimalToQueue(animal);
                            //Wil je meer dieren toevoegen? NEE->
                            //Sorteer de dieren
                            train.InsertAnimalsToWagon();
                        }
                    }
                    if (size == "medium")
                    {
                        animal.Size = AnimalSize.Medium;
                        Console.WriteLine("Voer een dieet in, kies uit 'vlees' of 'planten'");
                        string dieet = Console.ReadLine();
                        if (dieet == "vlees")
                        {
                            animal.Diet = AnimalDiet.Carnivore;
                            Console.ReadLine();
                            train.AddAnimalToQueue(animal);
                            train.InsertAnimalsToWagon();
                        }
                        if (dieet == "planten")
                        {
                            animal.Diet = AnimalDiet.Herbivore;
                            Console.ReadLine();
                            train.AddAnimalToQueue(animal);
                            train.InsertAnimalsToWagon();
                        }
                    }
                    if (size == "large")
                    {
                        animal.Size = AnimalSize.Large;
                        Console.WriteLine("Voer een dieet in, kies uit 'vlees' of 'planten'");
                        string dieet = Console.ReadLine();
                        if (dieet == "vlees")
                        {
                            animal.Diet = AnimalDiet.Carnivore;
                            Console.ReadLine();
                            train.AddAnimalToQueue(animal);
                            train.InsertAnimalsToWagon();
                        }
                        if (dieet == "planten")
                        {
                            animal.Diet = AnimalDiet.Herbivore;
                            Console.ReadLine();
                            train.AddAnimalToQueue(animal);
                            train.InsertAnimalsToWagon();
                        }
                    }
                }
            }
Пример #5
0
        public void RetrieveWagons()
        {
            var actualValue = train.RetrieveWagons();

            Assert.AreEqual(expectedValue.ToString(), actualValue.ToString());
        }