Example #1
0
        public void TestConsultarEventos()
        {
            List <Entidad> listaPrueba = new List <Entidad>();

            Assert.DoesNotThrow(() =>
            {
                listaPrueba = daoEvento.ConsultarLista(null);
            });
            foreach (Entidad entidad in listaPrueba)
            {
                if (entidad.Id == evento.Id)
                {
                    Assert.AreEqual(entidad.Id, evento.Id);
                    Assert.AreEqual(((Evento)evento).Nombre, ((Evento)entidad).Nombre);
                    Assert.AreEqual(((Evento)evento).Descripcion, ((Evento)entidad).Descripcion);
                    Assert.AreEqual(((Evento)evento).FechaInicio.Date, ((Evento)entidad).FechaInicio.Date);
                    Assert.AreEqual(((Evento)evento).FechaFin.Date, ((Evento)entidad).FechaFin.Date);
                    Assert.AreEqual(((Evento)evento).Foto, ((Evento)entidad).Foto);
                    Assert.AreEqual(((Evento)evento).HoraInicio.Hour, ((Evento)entidad).HoraInicio.Hour);
                    Assert.AreEqual(((Evento)evento).HoraInicio.Minute, ((Evento)entidad).HoraInicio.Minute);
                    Assert.AreEqual(((Evento)evento).HoraInicio.Second, ((Evento)entidad).HoraInicio.Second);
                    Assert.AreEqual(((Evento)evento).HoraFin.Hour, ((Evento)entidad).HoraFin.Hour);
                    Assert.AreEqual(((Evento)evento).HoraFin.Minute, ((Evento)entidad).HoraFin.Minute);
                    Assert.AreEqual(((Evento)evento).HoraFin.Second, ((Evento)entidad).HoraFin.Second);
                    Assert.AreEqual(((Evento)evento).Precio, ((Evento)entidad).Precio);
                    Assert.AreEqual(((Evento)evento).IdCategoria, ((Evento)entidad).IdCategoria);
                    Assert.AreEqual(((Evento)evento).IdLocalidad, ((Evento)entidad).IdLocalidad);
                }
            }
        }
        /// <summary>
        /// Metodo Ejecutar, realiza la logica del negocio para consultar todos los eventos.
        /// </summary>
        public override void Ejecutar()
        {
            try
            {
                eventos = daoEvento.ConsultarLista(null);
                log.Info("Ejecutado el comando");
            }

            catch (BaseDeDatosExcepcion e)
            {
                log.Error(e.Message);
                throw e;
            }
            catch (OperacionInvalidaExcepcion e)
            {
                log.Error(e.Message);
                throw e;
            }
            catch (Exception e)

            {
                log.Error(e.Message);
                throw e;
            }
        }