コード例 #1
0
        public void TestSearchMonHoc()
        {
            var _monHocController = new MonHocController();
            var monHoc = new MonHoc(id, maMH, tenMH, soTC, soGLT, soGTH, soGT, "");
            _monHocController.Create(monHoc);

            var result = _monHocController.SearchMonHoc(monHoc.tenMonHoc) as ViewResult;
            Assert.NotNull(result);
            _monHocController.Delete(monHoc.Id);
        }
コード例 #2
0
 public void TestEditMonHoc()
 {
     var _monHocController = new MonHocController();
     var monHoc = new MonHoc(id, maMH, tenMH, soTC, soGLT, soGTH, soGT, "");
     _monHocController.Create(monHoc);
     var result = _monHocController.Edit(monHoc.Id) as ViewResult;
     var mH = (MonHoc)result.ViewData.Model;
     Assert.AreEqual("Mon hoc 1", mH.tenMonHoc);
     _monHocController.Delete(monHoc.Id);
 }
コード例 #3
0
        public void TestDeleteMonHoc()
        {
            //Test chuc nang xoa Mon hoc khoi database
            var _monHocController = new MonHocController();
            var monHoc = new MonHoc(id, maMH, tenMH, soTC, soGLT, soGTH, soGT, "");
            _monHocController.Create(monHoc);

            var result = _monHocController.Delete(monHoc.Id) as ViewResult;
            var mH = (MonHoc)result.ViewData.Model;
            Assert.AreEqual("Mon hoc 1", mH.tenMonHoc);
        }
コード例 #4
0
        public void TestCreateMonHoc()
        {
            //Test chuc nang them mon hoc vao database
            var monHoc = new MonHoc(id, maMH, tenMH, soTC, soGLT, soGTH, soGT, "");

            var _monHocController = new MonHocController();
            var result = _monHocController.Create(monHoc) as RedirectToRouteResult;
            //Them mon hoc vao database
            Assert.NotNull(result);
            Assert.AreEqual("Index", result.RouteValues["action"]);

            _monHocController.Delete(monHoc.Id);
            //Xoa mon hoc da them
        }