示例#1
0
        public void DAOInsertarFoto()
        {
            iDAOFoto = FabricaDAO.CrearDAOFoto();

            // Descomentar las siguientes lineas al ejecutar la pu de forma individual
            //iDAOLugarTuristico = FabricaDAO.CrearDAOLugarTuristico();
            //iDAOLugarTuristico.Insertar(_lugaresTuristicos[0]);

            //Inserto la foto
            iDAOFoto.Insertar(_foto, _lugaresTuristicos[0]);

            //Busco la foto
            _fotos = iDAOFoto.ConsultarLista(_lugaresTuristicos[0]);

            Assert.IsNotNull(iDAOFoto);
            Assert.IsNotNull(iDAOLugarTuristico);

            Assert.AreEqual(_foto.Id, _fotos[0].Id);
            Assert.AreEqual(_foto.Ruta + "2.jpg", ((Foto)_fotos[0]).Ruta);
        }
 public override void Ejecutar()
 {
     try
     {
         // Insercion y asociacion de las fotos
         for (int i = 0; i < _foto.Count; i++)
         {
             iDAOFoto.Insertar(_foto[i], _lugarTuristico);
         }
     }
     catch (ReferenciaNulaExcepcion e)
     {
         log.Error(e.Mensaje);
         throw new ReferenciaNulaExcepcion(e, "Parametros de entrada nulos en: "
                                           + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message);
     }
     catch (CasteoInvalidoExcepcion e)
     {
         log.Error("Casteo invalido en:"
                   + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message);
         throw new CasteoInvalidoExcepcion(e, "Casteo invalido en: "
                                           + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message);
     }
     catch (BaseDeDatosExcepcion e)
     {
         log.Error("Ocurrio un error en la base de datos en: "
                   + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message);
         throw new BaseDeDatosExcepcion(e, "Ocurrio un error en la base de datos en: "
                                        + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message);
     }
     catch (Excepcion e)
     {
         log.Error("Ocurrio un error desconocido: "
                   + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message);
         throw new Excepcion(e, "Ocurrio un error desconocido en: "
                             + GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + ". " + e.Message);
     }
 }