public void DsBanYeuCau_TimTheoDungSucChua()
        {
            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, 10, 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);

            DSBan dsA      = dsB.DsBanYeuCau("10");
            bool  excepted = true;
            bool  actual   = false;

            foreach (Ban b in dsA.DsBan)
            {
                if (b.SucChua != 10)
                {
                    actual = false;
                    break;
                }
                actual = true;
            }

            Assert.AreEqual(excepted, actual);
        }
示例#2
0
 private void txtTimBan_TextChanged(object sender, EventArgs e)
 {
     char[] aSC = txtTimBan.Text.ToCharArray();
     foreach (char c in aSC)
     {
         if (!Char.IsNumber(c))
         {
             txtTimBan.Text = "";
             break;
         }
     }
     if (txtTimBan.Text != "")
     {
         dagvBan.DataSource = dsBanHienTai.DsBanYeuCau(txtTimBan.Text).TaoDataTableAo();
     }
     else
     {
         dagvBan.DataSource = dsBanHienTai.TaoDataTableAo();
     }
 }