Exemplo n.º 1
0
        public void AddNewStockTest()
        {
            // Arrange
            _inventory = new Inventory()
            {
                StockName = "1 Liter Per Box",
                DateAdded = DateTime.Today.Date,
                UnitPrice = Convert.ToDecimal(246)
            };

            // Act
            if (_inventory != null)
            {
                if (string.IsNullOrEmpty(_inventory.StockName) || _inventory.StockName == null)
                    Assert.IsNull(_inventory.StockName, "Provide stock name.");

                if (_inventory.UnitPrice == 0)
                    Assert.AreEqual(_inventory.UnitPrice > 0, 0, "Provide unit price.");
            }

            _inventoryLogic.AddNewStock(_inventory);

            // Assert
            Assert.IsNotNull(_inventory);
        }
Exemplo n.º 2
0
 public void AddStock(Inventory inventory)
 {
     _entity.sp_InventoryAddNewStock(inventory.StockName, inventory.DateAdded, inventory.UnitPrice);
 }
Exemplo n.º 3
0
 public void UpdateStockDetails(Inventory inventory)
 {
     _entity.sp_InventoryUpdateStock(inventory.StockId, inventory.StockName, inventory.DateAdded, inventory.UnitPrice);
 }
Exemplo n.º 4
0
        public void UpdateStockDetailsTest()
        {
            // Arrange
            _inventory = new Inventory()
            {
                StockId = 6,
                StockName = "1 Liter Per Box",
                DateAdded = DateTime.Today.Date,
                UnitPrice = Convert.ToDecimal(500)
            };

            // Act
            var currentStockDetail = _inventoryLogic.SearchStock(_inventory.StockId);
            var newStockDetail = _inventory;

            _repo.UpdateStockDetails(_inventory);

            // Assert
            Assert.AreNotEqual(newStockDetail, currentStockDetail);
        }