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); }
public void AddStock(Inventory inventory) { _entity.sp_InventoryAddNewStock(inventory.StockName, inventory.DateAdded, inventory.UnitPrice); }
public void UpdateStockDetails(Inventory inventory) { _entity.sp_InventoryUpdateStock(inventory.StockId, inventory.StockName, inventory.DateAdded, inventory.UnitPrice); }
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); }