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 DsBanDat_LayDungDSBanDat() { 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.DsBanDat().DsBan) { if (b.TinhTrang == true) { actual = false; break; } } Assert.AreEqual(excepted, actual); }