Exemplo n.º 1
0
        private void btnChuyen_Click(object sender, EventArgs e)
        {
            HangHoa hh = hangBLL.GetHangHoaByID(dgvHangHoa.SelectedRows[0].Cells[0].Value.ToString());

            if (hh.SoLuong < 1)
            {
                MessageBox.Show("Số lượng không đủ");
                txtSoLuong.Text = "1";
            }
            else
            {
                hh.SoLuong = 1;
                hoaDon.AddHangHoa(hh);
                ShowDanhSachHangHoa();
                txtTotalPrice.Text = hoaDon.TongTien.ToString();
            }
        }
Exemplo n.º 2
0
        public void Test_HoaDon_RemoveHangHoa()
        {
            HoaDon hd = new HoaDon();

            hd.AddHangHoa(new HangHoa());
            hd.RemoveHanghoa(new HangHoa());
            Assert.AreEqual(0, hd.DSHangHoa.Count);
        }
Exemplo n.º 3
0
        public void Test_HoaDon_TongHop()
        {
            HoaDon hd = new HoaDon();

            for (int i = 0; i < 9; i++)
            {
                hd.AddHangHoa(new HangHoa());
            }
            Assert.AreEqual(1, hd.DSHangHoa.Count);
        }
Exemplo n.º 4
0
        public void Test_HoaDon_GetTongTien()
        {
            HoaDon hd = new HoaDon();

            for (int i = 0; i < 9; i++)
            {
                hd.AddHangHoa(new HangHoa(i.ToString(), "", "", 0, 3000, 3, ""));
            }
            Assert.AreEqual(81000, hd.GetTotalPrice());
        }
Exemplo n.º 5
0
        public void Test_HoaDon_AddHangHoa_CungLoai()
        {
            //test logical
            HoaDon hd = new HoaDon();

            for (int i = 0; i < 9; i++)
            {
                hd.AddHangHoa(new HangHoa());
            }
            //check test
            Assert.AreEqual(1, hd.DSHangHoa.Count);
        }