Ejemplo n.º 1
0
        public void Update_TestCase5()
        {
            // insert chi tiet don thuoc moi
            ChiTietDonThuocDTO chiTietDonThuocDTO = new ChiTietDonThuocDTO
            {
                MaDonThuoc = TestCommon.LEN_10,
                MaThuoc    = TestCommon.LEN_10,
                SoLuong    = 10,
                GhiChu     = TestCommon.LEN_250
            };

            ChiTietDonThuocBUS chiTietDonThuocBUS = new ChiTietDonThuocBUS();

            chiTietDonThuocBUS.SaveChiTietDonThuoc(db, chiTietDonThuocDTO);
            //Update chi tiet don thuoc
            CHITIETDONTHUOC chiTietDonThuocUpdate = new CHITIETDONTHUOC
            {
                MaDonThuoc = TestCommon.LEN_10,
                MaThuoc    = TestCommon.LEN_10,
                SoLuong    = -10,
                GhiChu     = "abc"
            };
            // execute
            string actual   = chiTietDonThuocBUS.SaveChiTietDonThuoc(db, chiTietDonThuocDTO);
            string expected = "1111";

            // compare
            Assert.Equals(expected, actual);
        }
Ejemplo n.º 2
0
        public string UpdateChiTietDonThuoc(QLPHONGKHAMEntities db, ChiTietDonThuocDTO ChiTietDonThuocEntity)
        {
            // convert DTO -> DAO
            CHITIETDONTHUOC chiTietDonThuoc = new CHITIETDONTHUOC();

            BUS.Com.Utils.CopyPropertiesFrom(ChiTietDonThuocEntity, chiTietDonThuoc);
            // save
            return(chiTietDonThuocDAO.Save(db, chiTietDonThuoc));
        }
Ejemplo n.º 3
0
        public void Save_TestCase4()
        {
            ChiTietDonThuocDTO chiTietDonThuocDTO = new ChiTietDonThuocDTO {
            };
            ChiTietDonThuocBUS chiTietDonThuocBUS = new ChiTietDonThuocBUS();

            // execute
            string actual   = chiTietDonThuocBUS.SaveChiTietDonThuoc(db, chiTietDonThuocDTO);
            string expected = "1111";

            // compare
            Assert.Equals(actual, expected);
        }
Ejemplo n.º 4
0
        public void Delete_TestCase1()
        {
            ChiTietDonThuocDTO chiTietDonThuocDTO = new ChiTietDonThuocDTO
            {
                MaDonThuoc = TestCommon.LEN_10 + "1",
                MaThuoc    = TestCommon.LEN_10 + "1",
                SoLuong    = 123,
                GhiChu     = "abc"
            };
            ChiTietDonThuocBUS chiTietDonThuocBUS = new ChiTietDonThuocBUS();
            // execute
            string actual = chiTietDonThuocBUS.SaveChiTietDonThuoc(db, chiTietDonThuocDTO);

            // compare
            Assert.Equals(null, actual);
        }
Ejemplo n.º 5
0
        public void Save_TestCase2()
        {
            ChiTietDonThuocDTO chiTietDonThuocDTO = new ChiTietDonThuocDTO
            {
                MaDonThuoc = TestCommon.LEN_10 + "1",
                MaThuoc    = TestCommon.LEN_10 + "1",
                SoLuong    = 10,
                GhiChu     = TestCommon.LEN_250 + "1"
            };

            ChiTietDonThuocBUS chiTietDonThuocBUS = new ChiTietDonThuocBUS();

            // execute
            string actual   = chiTietDonThuocBUS.SaveChiTietDonThuoc(db, chiTietDonThuocDTO);
            string expected = "1111";

            // compare
            Assert.Equals(actual, expected);
        }
Ejemplo n.º 6
0
        public string GetListWithIdDonThuoc(QLPHONGKHAMEntities db, string MaDonthuoc, out List <ChiTietDonThuocDTO> listChiTiet)
        {
            listChiTiet = new List <ChiTietDonThuocDTO>();
            List <CHITIETDONTHUOC> listChiTietDAO = new List <CHITIETDONTHUOC>();

            chiTietDonThuocDAO.GetListWithIdDonThuoc(db, MaDonthuoc, out listChiTietDAO);
            try
            {
                foreach (var ct in listChiTietDAO)
                {
                    ChiTietDonThuocDTO temp = new ChiTietDonThuocDTO();
                    Utils.CopyPropertiesFrom(ct, temp);
                    listChiTiet.Add(temp);
                }
            }catch (Exception e)
            {
                return(Constant.RES_FAI);
            }
            return(Constant.RES_SUC);
        }