//Obtener reservas de un usuario con id del usuario inválido
        public void GetReservationFlightByUserIdExCommandTest()
        {
            GetReservationFlightByUserCommand command =
                CommandFactory.CreateGetReservationFlightByUserCommand(-1);

            Assert.Throws <ValidationErrorException>(delegate { command.Execute(); });
        }
        public void GetReservationFlightByUserCommandTest()
        {
            GetReservationFlightByUserCommand command =
                CommandFactory.CreateGetReservationFlightByUserCommand(1);

            command.Execute();
            List <Entity> listFlight = command.GetResult();

            Assert.AreNotEqual(null, listFlight);
        }
Ejemplo n.º 3
0
        public ActionResult <IEnumerable <Entity> > Get(int id_user)
        {
            try{
                //Instancia del comando
                GetReservationFlightByUserCommand command =
                    CommandFactory.CreateGetReservationFlightByUserCommand(id_user);

                //Ejecuta y obtiene el resultado del comando
                command.Execute();
                List <Entity> listFlight = command.GetResult();

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