Exemple #1
0
 private void btThem_Click(object sender, EventArgs e)
 {
     if (statuss != Status.isAdd)
     {
         statuss = Status.isAdd;
         status  = Status.isAdd;
         MessageBox.Show("Bạn vừa vào chế độ thêm");
     }
     else
     {
         Phong p = new Phong();
         p.H_muc   = Int32.Parse(txtHanMuc.Text);
         p.T_phong = txtPhong.Text;
         quanLyPhong.ThemPhong(p);
     }
 }
Exemple #2
0
        public void ThemPhong_TestStatusResponse()
        {
            var phong         = data_test.TaoMoiPhong();
            var action_result = controller.ThemPhong(phong);
            //act
            var actual_result1 = action_result as OkNegotiatedContentResult <string>;
            var actual_result2 = action_result as BadRequestErrorMessageResult;
            var expect_result1 = "Thêm phòng thành công!";
            var expect_result2 = "Lỗi phòng đã tồn tại!";

            //Assert
            try
            {
                Assert.AreEqual(expect_result1, actual_result1.Content);
            }
            catch (System.Exception)
            {
                Assert.AreEqual(expect_result2, actual_result2.Message);
            }
        }