public void TestCheckHopLe() { string maban = "1"; DateTime thoigian = DateTime.Now; DataSet dsHienThi = new DataSet(); string l = "select * from DatBan where MaBan = " + maban; strcon.Open(); OleDbDataAdapter daShowData = new OleDbDataAdapter(l, strcon); daShowData.Fill(dsHienThi); daShowData.Dispose(); strcon.Close(); bool expected = true; foreach (DataRow ds in dsHienThi.Tables[0].Rows) { if (Check.GioHopLe(DateTime.Parse(ds["ThoiGian"].ToString()), thoigian) != 0) { expected = false; } } bool actual = Ban.CheckHopLe(maban, thoigian); Assert.AreEqual(expected, actual); }
public string CheckMaBan() { DataTable dsb = Data.Load("Ban", "*"); foreach (DataRow dr in dsb.Rows) { string maban = dr["MaBan"].ToString(); if (Ban.CheckHopLe(maban, time) && int.Parse(dr["SucChua"].ToString()) >= int.Parse(this.soNg)) { return(maban); } } return(""); }