Exemplo n.º 1
0
        public string Play(string name, int procedureTime)
        {
            var animal = GetAnimal(name);

            play.DoService(animal, procedureTime);
            return($"{animal.Name} was playing for {procedureTime} hours");
        }
Exemplo n.º 2
0
        public string Play(string name, int procedureTime)
        {
            CheckIfAnimalExist(name);

            play.DoService(hotel.Animals[name], procedureTime);

            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 3
0
        public string Play(string name, int procedureTime)
        {
            DoesAnimalExistInHotel(name);
            var animal = this.hotel.Animals[name];

            play.DoService(animal, procedureTime);

            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 4
0
        public string Play(string name, int procedureTime)
        {
            IAnimal animal = CheckForAnimal(name);

            play.DoService(animal, procedureTime);
            string result =
                $"{name} was playing for {procedureTime} hours";

            return(result);
        }
Exemplo n.º 5
0
        public string Play(string name, int procedureTime)
        {
            CheckIfAnimalExists(name);
            IAnimal animal = GetAnimal(name);

            play.DoService(animal, procedureTime);
            play.ProcedureHistory.Add(animal);

            return($"{animal.Name} was playing for {procedureTime} hours");
        }
Exemplo n.º 6
0
        public string Play(string name, int procedureTime)
        {
            if (hotel.Animals.ContainsKey(name) == false)
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
            IAnimal currentAnimal = hotel.Animals.FirstOrDefault(x => x.Key == name).Value;

            play.DoService(currentAnimal, procedureTime);
            return($"{currentAnimal.Name} was playing for {procedureTime} hours");
        }
Exemplo n.º 7
0
        public string Play(string name, int procedureTime)
        {
            var animal = this.hotel
                         .Animals
                         .Values
                         .First(x => x.Name == name);

            play.DoService(animal, procedureTime);

            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 8
0
        public string Play(string name, int procedureTime)
        {
            if (!AnimalExists(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
            IAnimal currentAnimal = hotel.Animals[name];

            play.DoService(currentAnimal, procedureTime);
            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 9
0
        public string Play(string name, int procedureTime)
        {
            var animal = GetAnimal(name);


            played.DoService(animal, procedureTime);
            string result = $"{name} was playing for {procedureTime} hours";

            this.played.ProcedureHistory.Add(animal);
            return(result);
        }
Exemplo n.º 10
0
        public string Play(string name, int procedureTime)
        {
            IAnimal animal = GetAnimal(name, procedureTime);
            Play    play   = new Play();

            play.DoService(animal, procedureTime);
            AddToHistory(play.GetType().Name, animal);
            string result = $"{animal.Name} was playing for {procedureTime} hours";

            return(result);
        }
Exemplo n.º 11
0
        public string Play(string name, int procedureTime)
        {
            Play play = new Play();

            var animal = this.hotel.Animals[name];

            play.DoService(animal, procedureTime);

            this.proceduresAndItsAnimals["Play"].Add(animal);

            return($"{name} was playing for {procedureTime} hours");
        }
        public string Play(string name, int procedureTime)
        {
            if (!hotel.Animals.ContainsKey(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
            var animal = hotel.Animals[name];

            play.DoService(animal, procedureTime);

            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 13
0
        public string Play(string name, int procedureTime)
        {
            if (!AnimalExists(name))
            {
                throw new ArgumentException(string.Format(animalDoesntExistErrorMessage, name));
            }

            var animal = this.hotel.Animals.FirstOrDefault(a => a.Key == name).Value;

            play.DoService(animal, procedureTime);

            return(string.Format(playMessage, name, procedureTime));
        }
Exemplo n.º 14
0
        public string Play(string name, int procedureTime)
        {
            string played = "Play";

            CheckAnimalExist(name);
            IAnimal animal = GetAnimal(name);
            Play    play   = new Play();

            play.DoService(animal, procedureTime);
            AddHistory(animal, played);

            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 15
0
        public string Play(string name, int procedureTime)
        {
            CheckForAnimal(name);
            Play   play   = new Play();
            Animal animal = hotel.Animals.Values.FirstOrDefault(x => x.Name == name);

            play.DoService(animal, procedureTime);
            if (!history.ContainsKey("Play"))
            {
                history.Add("Play", new List <Animal>());
            }
            history["Play"].Add(animal);
            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 16
0
        public string Play(string name, int procedureTime)
        {
            if (IsExistInHotel(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
            Procedure procedure = new Play();

            procedure.DoService(animalsInHotel[name], procedureTime);
            procedures.Add(procedure);
            string result = $"{name} was playing for {procedureTime} hours";

            return(result);
        }
Exemplo n.º 17
0
        public string Play(string name, int procedureTime)
        {
            if (hotel.Animals.ContainsKey(name) == false)
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }

            var animal = hotel.Animals[name];

            play.DoService(animal, procedureTime);
            play.ProcedureHistory.Add(animal);
            this.procedures.Add(play);

            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 18
0
        public string Play(string name, int procedureTime)
        {
            AnimalDoesntExist(name);

            IAnimal animal = TakeAnimal(name);

            IProcedure play = new Play();

            play.DoService(animal, procedureTime);

            AddTypeProcedure(play);

            return(string.Format(
                       ConstantMessages.PlayingProcedure,
                       animal.Name,
                       procedureTime));
        }
Exemplo n.º 19
0
        public string Play(string name, int procedureTime)
        {
            this.DoesExist(name);

            var animal = hotel.GetAnimal(name);

            if (this.procedures.Any(p => p.GetType().Name == "Play"))
            {
                this.procedures.First(p => p.GetType().Name == "Play")
                .DoService(animal, procedureTime);
            }
            else
            {
                Procedure procedure = new Play();
                procedure.DoService(animal, procedureTime);
                this.procedures.Add(procedure);
            }

            return($"{name} was playing for {procedureTime} hours");
        }
Exemplo n.º 20
0
        public string Play(string name, int procedureTime)
        {
            if (!this.hotel.Animals.ContainsKey(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }

            var animal = this.hotel.Animals.First(x => x.Value.Name == name).Value;

            if (this.procedures.Any(x => x.GetType() == typeof(Play)))
            {
                this.procedures.First(x => x.GetType() == typeof(Play)).DoService(animal, procedureTime);
            }

            else
            {
                var play = new Play();
                play.DoService(animal, procedureTime);
                this.procedures.Add(play);
            }

            return($"{animal.Name} was playing for {procedureTime} hours");
        }