Beispiel #1
0
        public string ProcesadorMensajeEventos(Evento evento, DTOEvento dtoEvento, bool estatusEvento)
        {
            string mensaje = "";

            mensaje = string.Format("{0} {1} {2} {3}", evento.NombreEvento, DeterminarMensajeEvento(estatusEvento), dtoEvento.Diferencia.ToString(), dtoEvento.Periodo.ToString());
            return(mensaje);
        }
Beispiel #2
0
        private DTOEvento GenerarInstanciaDTOEvento(int minutos)
        {
            DTOEvento dtoEvento = new DTOEvento
            {
                Diferencia = minutos,
                Periodo    = "minutos"
            };

            return(dtoEvento);
        }
Beispiel #3
0
        private DTOEvento GenerarInstanciaDTOEvento(int horas)
        {
            DTOEvento dtoEvento = new DTOEvento
            {
                Diferencia = horas,
                Periodo    = "Horas"
            };

            return(dtoEvento);
        }
        private DTOEvento GenerarInstanciaDTOEvento(int Diferencia)
        {
            DTOEvento dtoEvento = new DTOEvento
            {
                Diferencia = Diferencia,
                Periodo    = "Meses"
            };

            return(dtoEvento);
        }
Beispiel #5
0
        public DTOEvento CalcularRangoEvento(DateTime fechaEvento)
        {
            int      Horas     = 0;
            TimeSpan rangoBase = _rangoBase.CalcularRangoBase(fechaEvento);

            Horas = ObtenerDifrenciaHora(rangoBase);
            if (Horas > 0)
            {
                DTOEvento dtoEvento = this.GenerarInstanciaDTOEvento(Horas);
                return(dtoEvento);
            }
            else
            {
                return(_rangoOtroPeriodo.CalcularRangoEvento(fechaEvento));
            }
        }
Beispiel #6
0
        public DTOEvento CalcularRangoEvento(DateTime fechaEvento)
        {
            int      Minutos   = 0;
            TimeSpan rangoBase = calculadorRangoBase.CalcularRangoBase(fechaEvento);

            Minutos = ObtenerDiferenciaMinutos(rangoBase);
            if (Minutos > 0)
            {
                DTOEvento dtoEvento = this.GenerarInstanciaDTOEvento(Minutos);
                return(dtoEvento);
            }
            else
            {
                return(_rangoOtroPeriodo.CalcularRangoEvento(fechaEvento));
            }
        }
        public DTOEvento CalcularRangoEvento(DateTime fechaEvento)
        {
            int      Meses          = 0;
            int      Dias           = 0;
            TimeSpan DiferenciaBase = _rangoBase.CalcularRangoBase(fechaEvento);

            Dias  = ObtenerDiferenciaDias(DiferenciaBase);
            Meses = ObtenerDiferenciaMes(Dias, fechaEvento);

            if (Meses > 0)
            {
                DTOEvento dtoEvento = GenerarInstanciaDTOEvento(Meses);
                return(dtoEvento);
            }
            else
            {
                return(_rangoOtroPeriodo.CalcularRangoEvento(fechaEvento));
            }
        }
Beispiel #8
0
        public void ProcesadorMensajeEventos_VerificarEventoFuturo_MensajeEventoFuturo()
        {
            //ARRANGE
            Evento evento = new Evento();

            evento.FechaEvento  = new DateTime(2020, 02, 05, 20, 00, 00);
            evento.NombreEvento = "Constitución Política";
            DTOEvento dtoEvento = new DTOEvento();

            dtoEvento.Diferencia = 1;
            dtoEvento.Periodo    = "horas";
            bool estatusEvento = false;
            var  SUT           = new ProcesadorMensajes();

            //ACT
            string cadenaMensaje = SUT.ProcesadorMensajeEventos(evento, dtoEvento, estatusEvento);

            //ASSERT
            Assert.AreEqual(expected: cadenaMensaje, actual: "Constitución Política ocurrirá en 1 horas");
        }
Beispiel #9
0
 public void Put(int id, [FromBody] DTOEvento eventoDTO)
 {
     mAppEvento.Atualizar(id, eventoDTO);
 }
Beispiel #10
0
 public DTOId Post([FromBody] DTOEvento eventoDTO)
 {
     return(mAppEvento.Incluir(eventoDTO));
 }