// 清空購物車 private void CleanOrderAndResetButton() { _orderDataGridView.Rows.Clear(); // 清空右邊欄位 _totalPriceLabel.ResetText(); // 清空總金額 _shopListPresentationModel.ResetCart(); // 清空購物車List _orderButton.Enabled = _shopListPresentationModel.CheckConfirmButton(); // 訂購按鈕不能再按下 }
public void ResetCartTest() { _ShopListPresentationModel.GetCurrentProduce("1", 0, "主機板"); _ShopListPresentationModel.AddItemToCart(); _ShopListPresentationModel.GetCurrentProduce("1", 1, "主機板"); _ShopListPresentationModel.AddItemToCart(); Assert.AreEqual(_ShopListPresentationModel.RowCount, 2); _ShopListPresentationModel.ResetCart(); Assert.AreEqual(_ShopListPresentationModel.RowCount, 0); }