public void M10_DaoListarRestaurantes() { restaurantDao = FabricaDAO.RestaurantBD(); ListaRestaurant = restaurantDao.ListarRestaurantes(); //Ciclo para verificar que la filas de la consulta no se encuentran en null foreach (Entidad rest in ListaRestaurant) { Assert.IsNotNull(((CRestauranteModelo)rest).id); Assert.IsNotNull(((CRestauranteModelo)rest).nombre); } }
/// <summary> /// Metodo para consultar en la base de datos los restaurante segun la ciudad elegida /// </summary> /// <returns></returns> public override List <Entidad> ejecutar() { try { IDAORestaurant restaurantDao = FabricaDAO.RestaurantBD(); return(restaurantDao.Consultar(this._objeto)); } catch (NotImplementedException e) { throw new ExceptionReserva("Reserva-404", "Metodo no implementado", e); } catch (Exception e) { throw new ExceptionReserva("Reserva-404", "Error al Realizar Operacion", e); } }
public void M10_DaoCrear() { restaurantDao = FabricaDAO.RestaurantBD(); //Parametros para crear el nuevo registro en la base de datos ((CRestauranteModelo)restaurant).nombre = "ItalyFood"; ((CRestauranteModelo)restaurant).descripcion = "Comida Italiana"; ((CRestauranteModelo)restaurant).direccion = "Antiamano"; ((CRestauranteModelo)restaurant).Telefono = "0212-5896699"; ((CRestauranteModelo)restaurant).horarioApertura = "09:00"; ((CRestauranteModelo)restaurant).horarioCierre = "21:00"; ((CRestauranteModelo)restaurant).idLugar = 12; Resultado = restaurantDao.Crear(restaurant); //Verificar si el resultado fue exitoso Assert.AreEqual(Resultado, true); }
public void M10_DaoConsultarRestaurant() { restaurantDao = FabricaDAO.RestaurantBD(); ListaRestaurant = restaurantDao.Consultar(lugar); //COmo se devuelve una lista de restaurantes segun el id de lugar se verifica si los //no estan nulos foreach (Entidad rest in ListaRestaurant) { Assert.IsNotNull(((CRestauranteModelo)rest).id); Assert.IsNotNull(((CRestauranteModelo)rest).nombre); Assert.IsNotNull(((CRestauranteModelo)rest).descripcion); Assert.IsNotNull(((CRestauranteModelo)rest).direccion); Assert.IsNotNull(((CRestauranteModelo)rest).Telefono); Assert.IsNotNull(((CRestauranteModelo)rest).horarioApertura); Assert.IsNotNull(((CRestauranteModelo)rest).horarioCierre); Assert.IsNotNull(((CRestauranteModelo)rest).idLugar); } }
public void M10_DaoModificar() { restaurantDao = FabricaDAO.RestaurantBD(); //Parametros a modificar en la base de datos //Id del restaurante a modificar ((CRestauranteModelo)restaurant).id = 107; //Parametros que va a ser modificados ((CRestauranteModelo)restaurant).nombre = "ItaliaFood"; ((CRestauranteModelo)restaurant).descripcion = "Comida Italiana"; ((CRestauranteModelo)restaurant).direccion = "Antimano"; ((CRestauranteModelo)restaurant).Telefono = "0212-5896699"; ((CRestauranteModelo)restaurant).horarioApertura = "09:00"; ((CRestauranteModelo)restaurant).horarioCierre = "21:00"; ((CRestauranteModelo)restaurant).idLugar = 12; //Veridicar si la modificacion fue exitosa Resultado = restaurantDao.Modificar(restaurant); Assert.AreEqual(Resultado, true); }
public void M10_DaoEliminar() { restaurantDao = FabricaDAO.RestaurantBD(); //Parametros para crear el nuevo registro en la base de datos ((CRestauranteModelo)restaurant).nombre = "ItalyFood"; ((CRestauranteModelo)restaurant).descripcion = "Comida Italiana"; ((CRestauranteModelo)restaurant).direccion = "Antiamano"; ((CRestauranteModelo)restaurant).Telefono = "0212-5896699"; ((CRestauranteModelo)restaurant).horarioApertura = "09:00"; ((CRestauranteModelo)restaurant).horarioCierre = "21:00"; ((CRestauranteModelo)restaurant).idLugar = 12; Resultado = restaurantDao.Crear(restaurant); //Verificar si el resultado fue exitoso Assert.AreEqual(Resultado, true); Entidad rest = FabricaEntidad.crearRestaurant(); String StringConection = restaurantDao.ConectionString(); String sqlString = "SELECT TOP 1 rst_id FROM Restaurante where fk_lugar = 12 ORDER BY rst_id DESC;"; SqlConnection conexion = new SqlConnection(StringConection); conexion.Open(); SqlCommand cmd = new SqlCommand(sqlString, conexion); SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); int idRestaurant = int.Parse(reader["rst_id"].ToString()); IDAORestaurant restaurantDao1 = FabricaDAO.RestaurantBD(); restaurante._id = idRestaurant; Boolean Resultado2 = restaurantDao1.Eliminar(restaurante); //Verificar si el resultado fue exitoso Assert.AreEqual(Resultado2, true); }
public void M10_ComandoEliminar() { restaurantDao = FabricaDAO.RestaurantBD(); //Parametros para crear el nuevo registro en la base de datos ((CRestauranteModelo)restaurant).nombre = "ItalyFood"; ((CRestauranteModelo)restaurant).descripcion = "Comida Italiana"; ((CRestauranteModelo)restaurant).direccion = "Antimano"; ((CRestauranteModelo)restaurant).Telefono = "0212-5896699"; ((CRestauranteModelo)restaurant).horarioApertura = "09:00"; ((CRestauranteModelo)restaurant).horarioCierre = "21:00"; ((CRestauranteModelo)restaurant).idLugar = 12; Command <Boolean> comando = (Command <Boolean>)FabricaComando.comandosRestaurant(FabricaComando.comandosGlobales.CREAR, BOReserva.Controllers.PatronComando.FabricaComando.comandoRestaurant.NULO, restaurant); //Verificar si el resultado fue exitoso Assert.AreEqual(comando.ejecutar(), true); Entidad rest = FabricaEntidad.crearRestaurant(); String StringConection = restaurantDao.ConectionString(); String sqlString = "SELECT TOP 1 rst_id FROM Restaurante where fk_lugar = 12 ORDER BY rst_id DESC;"; SqlConnection conexion = new SqlConnection(StringConection); conexion.Open(); SqlCommand cmd = new SqlCommand(sqlString, conexion); SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); int idRestaurant = int.Parse(reader["rst_id"].ToString()); restaurante._id = idRestaurant; Command <Boolean> comando1 = (Command <Boolean>)FabricaComando.comandosRestaurant(FabricaComando.comandosGlobales.ELIMINAR, BOReserva.Controllers.PatronComando.FabricaComando.comandoRestaurant.NULO, restaurante); //Verificar si el resultado fue exitoso Assert.AreEqual(comando1.ejecutar(), true); }