Пример #1
0
        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);
        }
Пример #2
0
        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);
        }