Beispiel #1
0
        public void LocBan()
        {
            switch (cbxDSBan.SelectedItem.ToString())
            {
            case "Tất cả bàn":
            {
                dsBanHienTai       = dsBan;
                dagvBan.DataSource = dsBanHienTai.TaoDataTableAo();
            }
            break;

            case "Bàn trống":
            {
                dsBanHienTai       = dsBan.DsBanTrong();
                dagvBan.DataSource = dsBanHienTai.TaoDataTableAo();
            }
            break;

            case "Bàn đang đặt":
            {
                dsBanHienTai       = dsBan.DsBanDat();
                dagvBan.DataSource = dsBanHienTai.TaoDataTableAo();
            }
            break;
            }
        }
        public void DsBanTrong_LayDungDSBanTrong()
        {
            Ban b0 = new Ban(0, 0);
            Ban b1 = new Ban(111, 10, true);
            Ban b2 = new Ban(112, 15, false);
            Ban b3 = new Ban(113, 16, true);
            Ban b4 = new Ban(114, 6, false);

            DSBan dsB = new DSBan();

            dsB.ThemBan(b0);
            dsB.ThemBan(b1);
            dsB.ThemBan(b2);
            dsB.ThemBan(b3);
            dsB.ThemBan(b4);

            bool excepted = true;
            bool actual   = true;

            foreach (Ban b in dsB.DsBanTrong().DsBan)
            {
                if (b.TinhTrang == false)
                {
                    actual = false;
                    break;
                }
            }

            Assert.AreEqual(excepted, actual);
        }