public void GetLatestItemDetailTest() { String[] inventoryForm = new string[] { "Acer N50-600 i5-8400", "套裝電腦", "26,900", "5" }; for (int i = 0; i < inventoryForm.Length; i++) { Assert.AreEqual(_inventorySystemPresentationModel.GetLatestItemDetail()[i], inventoryForm[i]); } }
// 更新商品資料 public void UpdateProductData() { int rowIndex = _productManagement.GetEditProductIndexOfAllProducts(); try { _itemDataGridView.Rows[rowIndex].Cells[NAME_COLUMN_INDEX].Value = _inventorySystemPresentationModel.GetName(); _itemDataGridView.Rows[rowIndex].Cells[TYPE_COLUMN_INDEX].Value = _inventorySystemPresentationModel.GetCategory(); _itemDataGridView.Rows[rowIndex].Cells[PRICE_COLUMN_INDEX].Value = _inventorySystemPresentationModel.GetPrice(); _itemDataGridView.Rows[rowIndex].Cells[STOCK_COLUMN_INDEX].Value = _inventorySystemPresentationModel.GetStock(); _itemPictureBox.Image = _inventorySystemPresentationModel.GetImageFilePath(_itemDataGridView.CurrentCell.RowIndex); _itemDetailTextBox.Text = _inventorySystemPresentationModel.GetItemDetail(_itemDataGridView.CurrentCell.RowIndex); } catch { _itemDataGridView.Rows.Add(_inventorySystemPresentationModel.GetLatestItemDetail()); } }