예제 #1
0
 public void EvaluarEvento(Lectura.Evento evento)
 {
     if (!PersistirEvento(evento))
     {
         manejador?.EvaluarEvento(evento);
     }
 }
예제 #2
0
        public void ConvertidorTest_RegresaEvento_ConvertirEvento()
        {
            //Arrange
            string _cEvento = "Hanal Pixán, 01/10/2020";

            Lectura.Evento _eventoEsperado = new Lectura.Evento {
                cNombre = "Hanal Pixán", dtFecha = DateTime.Parse("01/10/2020")
            };

            //Act
            Lectura.Evento _eventoResultado = convertidor.ConvertirEvento(_cEvento);

            //Assert
            Assert.AreEqual(_eventoEsperado.cNombre, _eventoResultado.cNombre);
            Assert.AreEqual(_eventoEsperado.dtFecha, _eventoResultado.dtFecha);
        }
예제 #3
0
        protected override bool PersistirEvento(Lectura.Evento evento)
        {
            double _dRangoTiempo = ObtenerRangoTiempoPorDias(evento.dtFecha);

            if (_dRangoTiempo < 30)
            {
                string _cOcurrencia = ocurrencia.ObtenerOcurrencia(evento.dtFecha);

                string _cMensaje = ObtenerMensaje(evento.cNombre, _cOcurrencia, _dRangoTiempo);

                escritor.EscribirResultado(_cMensaje);

                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        public Lectura.Evento ConvertirEvento(string cEvento)
        {
            Lectura.Evento _evento;
            try
            {
                string[] _arrayEventos = cEvento.Split(',');

                _evento = new Lectura.Evento {
                    cNombre = _arrayEventos[0], dtFecha = Convert.ToDateTime(_arrayEventos[1])
                };

                Modelo.Evento evento = new Modelo.Evento {
                    Nombre = _evento.cNombre, Fecha = _evento.dtFecha
                };

                eventoService.InsertarEvento(evento);
            }
            catch (IndexOutOfRangeException)
            {
                throw new IndexOutOfRangeException("Indice fuera de rango, posiblemente alguna linea del archivo no cumpla con el formato adecuado de eventos.");
            }
            return(_evento);
        }
예제 #5
0
 protected abstract bool PersistirEvento(Lectura.Evento evento);
예제 #6
0
 private void EvaluarPersistenciaEvento(IManejadorRangos manejador, Lectura.Evento evento)
 {
     manejador.EvaluarEvento(evento);
 }