/// <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(); }
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); } }
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); }