Ejemplo n.º 1
0
        public void Create(AnimalTypeEnum animalType, string name)
        {
            switch (animalType)
            {
            case AnimalTypeEnum.Cat:
                _animals.Add(new Cat(name));
                break;

            case AnimalTypeEnum.Lion:
                _animals.Add(new Lion(name));
                break;

            case AnimalTypeEnum.Dog:
                _animals.Add(new Dog(name));
                break;

            case AnimalTypeEnum.Wolf:
                _animals.Add(new Wolf(name));
                break;

            case AnimalTypeEnum.Mouse:
                _animals.Add(new Mouse(name));
                break;

            case AnimalTypeEnum.Rat:
                _animals.Add(new Rat(name));
                break;

            default:
                _cli.DisplayError($"No such type.");
                break;
            }

            _cli.DisplayInfo($"Created {animalType} with name {name}.");
        }
Ejemplo n.º 2
0
        public void Create(AnimalTypeEnum animalType, string name)
        {
            new CreateAnimalCommand(_animals, animalType, name).Execute();

            _cli.DisplayInfo($"Created {animalType} with name {name}.");
        }