Example #1
0
        public bool NotificaCaducados()
        {
            List <Bodega> lista = (from v in _bodega.GetAll <Bodega>()
                                   where v.Botella.Caducidad <= DateTime.Today.AddMonths(1) &&
                                   v.NotificadoCaducidad == false
                                   select v).ToList();

            foreach (Bodega b in lista)
            {
                _notificacionService.NotificacionCaducidad(b);
                b.NotificadoCaducidad = true;
                _bodega.Update(b.Id, b);
            }
            return(true);
        }
        public void NotificacionCaducidadNotThrow()
        {
            //Arrange
            Bodega bodega = new Bodega()
            {
                Botella = new Botella()
                {
                    Caducidad = DateTime.Today, Vino = new Vino()
                    {
                        Nombre = "nombre"
                    }
                }
            };

            try
            {
                _service.NotificacionCaducidad(bodega);
                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }