Пример #1
0
        public void TestDeleteShouldReturnOne()
        {
            DepartmentDAO dao = new DepartmentDAO();
            Department    dep = dao.GetByDepartmentName("Medical");

            if (dep == null)//did delete run before create
            {
                TestCreateShouldReturnNewId();
                dep = dao.GetByDepartmentName("Medical");
            }
            Assert.IsTrue(dao.Delete(dep.GetIdAsString()) == 1);
        }
Пример #2
0
        public void TestUpdateShouldReturnStale()
        {
            DepartmentDAO dao  = new DepartmentDAO();
            Department    dep  = dao.GetByDepartmentName("Lab");
            Department    dep2 = dao.GetByDepartmentName("Lab");

            dep.DepartmentName  = "Butcher";
            dep2.DepartmentName = "LOL";
            UpdateStatus status = dao.Update(dep);

            Assert.IsTrue(dao.Update(dep2) == UpdateStatus.Stale);
        }
Пример #3
0
        public void TestUpdateShouldReturnOk()
        {
            DepartmentDAO dao = new DepartmentDAO();
            Department    dep = dao.GetByDepartmentName("Maintenance");

            dep.DepartmentName = "Butcher";
            Assert.IsTrue(dao.Update(dep) == UpdateStatus.Ok);
        }
Пример #4
0
        public DepartmentDAOTests()
        {
            DALUtils util = new DALUtils();

            util.LoadCollections();

            DepartmentDAO dao = new DepartmentDAO();
            Department    dep = dao.GetByDepartmentName("Administration");

            did = dep.GetIdAsString();
        }
Пример #5
0
 public void GetByDepartmentName()
 {
     try
     {
         Department dep = _dao.GetByDepartmentName(Name);
         Id      = dep.GetIdAsString();
         Name    = dep.DepartmentName;
         Version = dep.Version;
     }
     catch (Exception ex)
     {
         ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "GetByDepartmentName");
     }
 }
Пример #6
0
        public void GetByDepartmentName()
        {
            try
            {
                Department dept = _dao.GetByDepartmentName(DepartmentName);

                DepartmentName = dept.DepartmentName;
                Id             = dept.GetIdAsString();
            }
            catch (Exception ex)
            {
                DepartmentName = "not found";
                ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "GetByDepartmentName");
            }
        }
Пример #7
0
        public void TestGetByDepartmentNameShouldReturnDepartment()
        {
            DepartmentDAO dao = new DepartmentDAO();

            Assert.IsInstanceOfType(dao.GetByDepartmentName("Administration"), typeof(Department));
        }