Ejemplo n.º 1
0
        /// <summary>
        /// Metodo utilizados para casos borde(excepciones) de AgregarItinerario
        /// </summary>
        public void Excepcion_Agregar2()
        {
            itinerario = new Itinerario("Michel", 0);
            Comando comando = FabricaComando.CrearComandoAgregarItinerario(itinerario.Id, itinerario.Nombre);

            comando.Ejecutar();
        }
Ejemplo n.º 2
0
 public Itinerario AgregarItinerario(Itinerario it)
 {
     try
     {
         comando = FabricaComando.CrearComandoAgregarItinerario(it.IdUsuario, it.Nombre);
         comando.Ejecutar();
         Itinerario itNew = (Itinerario)comando.Retornar();
         return(itNew);
     }
     catch (NpgsqlException e)
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
     catch (InvalidCastException)
     {
         throw new HttpResponseException(HttpStatusCode.BadRequest);
     }
     catch (NullReferenceException)
     {
         throw new HttpResponseException(HttpStatusCode.BadRequest);
     }
     catch (Exception)
     {
         throw new HttpResponseException(HttpStatusCode.Ambiguous);
     }
 }
Ejemplo n.º 3
0
        public void PUAgregarItinerario()
        {
            string  nombre  = "Pirulin30";
            Comando comando = FabricaComando.CrearComandoAgregarItinerario(2, nombre);

            comando.Ejecutar();
            Itinerario itNew = (Itinerario)comando.Retornar();

            Assert.AreEqual(nombre, itNew.Nombre);
            Assert.AreEqual(30, itNew.Id);
        }