Ejemplo n.º 1
0
        public int RestaBodega(int idBotella)
        {
            //es un borrado lógico
            Bodega bodega = _bodega.Find <Bodega>(x => x.IdBotella == idBotella);
            int    result = bodega.Unidades - 1;

            if (bodega.Unidades == 1)
            {
                _bodega.Delete(bodega);
            }
            else
            {
                bodega.Unidades = result;
                _bodega.Update(bodega.Id, bodega);
            }
            _notificacionService.NotificacionExtraido(1, bodega);
            _logService.LogInventario(String.Format(StringEnum.GetStringValue(MensajeNotificaciones.Extraccion), "1", bodega.Botella.Descripcion));
            return(result);
        }
        public void NotificacionExtraidoNotThrow()
        {
            //Arrange
            Bodega bodega = new Bodega()
            {
                Botella = new Botella()
                {
                    Caducidad = DateTime.Today, Vino = new Vino()
                    {
                        Nombre = "nombre"
                    }
                }
            };

            try
            {
                _service.NotificacionExtraido(1, bodega);
                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }