Exemplo n.º 1
0
        private Animal returnNewAnimal(string name, string kind)
        {
            Animal animal = null;

            switch (kind)
            {
            case "lion":
                animal = new LionFactory().CreateAnimal(name);
                break;

            case "tiger":
                animal = new TigerFactory().CreateAnimal(name);
                break;

            case "elephant":
                animal = new ElephantFactory().CreateAnimal(name);
                break;

            case "bear":
                animal = new BearFactory().CreateAnimal(name);
                break;

            case "wolf":
                animal = new WolfFactory().CreateAnimal(name);
                break;

            case "fox":
                animal = new FoxFactory().CreateAnimal(name);
                break;
            }

            return(animal);
        }
Exemplo n.º 2
0
        public void IsContainerAlreadyContainsComponent_WhenAnimalNotInAnyContainer_ReturnsFalse()
        {
            bearCage.Add(bearFemaleCage);
            Bear bear = new BearFactory().CreateAnimal(Lab2Zoo.Models.Enums.MaleMode.Female) as Bear;

            Assert.False(bearCage.IsContainerAlreadyContainsComponent(bear));
        }
Exemplo n.º 3
0
        public void IsContainerAlreadyContainsComponent_WhenTryToAddAlreadyExistingAnimal_ReturnsTrue()
        {
            bearCage.Add(bearFemaleCage);
            Bear bear = new BearFactory().CreateAnimal(Lab2Zoo.Models.Enums.MaleMode.Female) as Bear;

            bearFemaleCage.Add(bear);

            Assert.True(bearCage.IsContainerAlreadyContainsComponent(bear));
        }
Exemplo n.º 4
0
        private void CreateAnimal()
        {
            byte typeOfAnimal = DisplaySelectTypeOfNewAnimal();

            if (typeOfAnimal == 0)
            {
                DisplayMainMenu();
                return;
            }

            string name   = DisplayInputName();
            ushort weight = DisplayInputWeight();

            Animal newAnimal = null;

            switch (typeOfAnimal)
            {
            case 1:
            {
                newAnimal = new BearFactory().CreateAnimal(DisplaySelectMaleOfBear());
                break;
            }

            case 2:
            {
                newAnimal = new GiraffeFactory().CreateAnimal(DisplaySelectAgeOfGiraffe());
                break;
            }

            case 3:
            {
                newAnimal = new WhiteWolfFactory().CreateAnimal();
                break;
            }

            case 4:
            {
                newAnimal = new GreyWolfFactory().CreateAnimal();
                break;
            }
            }

            newAnimal.Name   = name;
            newAnimal.Weight = weight;

            ComponentIsCreated(newAnimal);
            DisplayHowSelectContainerForAnimal(newAnimal);
        }
Exemplo n.º 5
0
        public ZooTest()
        {
            zoo = Lab2Zoo.Models.Factories.ZooFactory.CreateZoo();
            giraffeCageFactory = new GiraffeCageFactory();
            giraffeFactory     = new GiraffeFactory();
            bearFactory        = new BearFactory();
            bearCageFactory    = new BearCageFactory();

            giraffe     = giraffeFactory.CreateAnimal() as Giraffe;
            bear        = bearFactory.CreateAnimal() as Bear;
            giraffeCage = giraffeCageFactory.CreateCage() as GiraffeCage;
            bearCage    = bearCageFactory.CreateCage() as BearCage;

            zoo.Add(giraffeCage);
            zoo.Add(bearCage);

            giraffeCage.Add(giraffe);
            bearCage.Add(bear);
        }
Exemplo n.º 6
0
        public ContainerTest()
        {
            zoo = Lab2Zoo.Models.Factories.ZooFactory.CreateZoo();

            bearCageFactory       = new BearCageFactory();
            bearFemaleCageFactory = new FemaleBearCageFactory();
            bearMaleCageFactory   = new MaleBearCageFactory();

            bearFactory    = new BearFactory();
            giraffeFactory = new GiraffeFactory();

            mainBearCage   = bearCageFactory.CreateCage() as BearCage;
            bearFemaleCage = bearFemaleCageFactory.CreateCage() as BearFemaleCage;
            bearMaleCage   = bearMaleCageFactory.CreateCage() as BearMaleCage;

            maleBear   = bearFactory.CreateAnimal(Lab2Zoo.Models.Enums.MaleMode.Male) as Bear;
            femaleBear = bearFactory.CreateAnimal(Lab2Zoo.Models.Enums.MaleMode.Female) as Bear;

            giraffe = giraffeFactory.CreateAnimal(15) as Giraffe;

            zoo.Add(bearMaleCage);
            zoo.Add(mainBearCage);
            mainBearCage.Add(bearFemaleCage);
        }
Exemplo n.º 7
0
 public BearTestClass()
 {
     bearFactory = new BearFactory();
     bear        = bearFactory.CreateAnimal(Lab2Zoo.Models.Enums.MaleMode.Female) as Bear;
 }
 public BearFactoryTestClass()
 {
     bearFactory = new BearFactory();
 }