Beispiel #1
0
        public void SalidaProductoSimpleTest()
        {
            _salidaService = new SalidaProductoService(new UnitOfWorkFake(), new ProductoRepositoryStub());
            var response = _salidaService.Ejecutar(new SalidaProductoRequest("001", 3));

            Assert.AreEqual("Nueva salida: Pan, cantidad:3, costo_total:$ 500,00, precio_total:$ 0,00", response.Mensaje);
        }
Beispiel #2
0
        public SalidaProductoResponse PostSalidaProducto(SalidaProductoRequest request)
        {
            var service  = new SalidaProductoService(_unitOfWork, _productoRepository);
            var response = service.Ejecutar(request);

            return(response);
        }
Beispiel #3
0
        public void Setup()
        {
            var connection = new SqliteConnection("Filename=:memory:");
            //Arrange
            var optionsSqlite = new DbContextOptionsBuilder <ventasContext>()
                                .UseSqlite(connection)
                                .Options;

            connection.Open();

            _dbContext = new ventasContext(optionsSqlite);
            _dbContext.Database.EnsureDeleted();
            _dbContext.Database.EnsureCreated();

            _salidaService = new SalidaProductoService(
                new UnitOfWork(_dbContext),
                new ProductoRepository(_dbContext));

            ProductoSimple pan = (ProductoSimple)ProductoMother.ProductoPan("005");

            pan.RegistrarEntrada(10);

            ProductoSimple salchicha = (ProductoSimple)ProductoMother.ProductoSalchicha("006");

            salchicha.RegistrarEntrada(10);

            ProductoCompuesto perro = new("004", "Perro", 5000, new List <Producto> {
                pan, salchicha
            });

            //_dbContext.Productos.Add(pan);
            _dbContext.Productos.Add(salchicha);
            _dbContext.Productos.Add(perro);
            _dbContext.SaveChanges();
        }
        public void Setup()
        {
            //Arrange
            var optionsSqlite = new DbContextOptionsBuilder <ventasContext>()
                                .UseSqlite(@"Data Source=ventasDataBaseTest.db")
                                .Options;

            _dbContext = new ventasContext(optionsSqlite);
            _dbContext.Database.EnsureDeleted();
            _dbContext.Database.EnsureCreated();

            _salidaService = new SalidaProductoService(
                new UnitOfWork(_dbContext),
                new ProductoRepository(_dbContext));
        }