//Obtener con segunda locación inexistente
        public void GetIdReturnCitySecondLocationExCommandTest()
        {
            List <string> city_names = new List <string>();

            city_names.Add("Caracas");
            city_names.Add("petare");

            GetIdReturnCityCommand command = CommandFactory.CreateGetIdReturnCityCommand(city_names);

            Assert.Throws <ValidationErrorException>(delegate { command.Execute(); });
        }
        public void GetIdReturnCityCommandTest()
        {
            List <string> city_names = new List <string>();

            city_names.Add("Caracas");
            city_names.Add("Caracas");

            GetIdReturnCityCommand command = CommandFactory.CreateGetIdReturnCityCommand(city_names);

            command.Execute();

            List <int> city_ids = command.GetResult();

            Assert.AreNotEqual(null, city_ids);
        }
Ejemplo n.º 3
0
        public ActionResult <IEnumerable <int> > Get(string name_city_i, string name_city_v)
        {
            try{
                List <string> city_names = new List <string>();
                city_names.Add(name_city_i);
                city_names.Add(name_city_v);

                GetIdReturnCityCommand command = CommandFactory.CreateGetIdReturnCityCommand(city_names);

                command.Execute();
                List <int> city_ids = command.GetResult();

                return(city_ids);
            }catch (ValidationErrorException ex)
            {
                return(BadRequest(ex.Message));
            }catch (Exception ex) {
                return(BadRequest(ex.Message));
            }
        }