public void TestCreateShouldReturnNewId()
    {
        Department    dep = new Department();
        DepartmentDAO dao = new DepartmentDAO();

        dep.DepartmentName = "Test Department";
        dep.Version        = 1;
        Assert.IsTrue(dao.Create(dep).GetIdAsString().Length == 24);
    }// TestCreateShouldReturnNewId
Exemple #2
0
        public void TestCreateShouldReturnNewId()
        {
            DepartmentDAO dao = new DepartmentDAO();
            Department    dep = new Department();

            dep.DepartmentName = "Medical";
            dep.Version        = 1;
            // 12 byte hex = 24 byte string
            Assert.IsTrue(dao.Create(dep).GetIdAsString().Length == 24);
        }
Exemple #3
0
 public void Create()
 {
     try
     {
         Department dep = new Department();
         dep.DepartmentName = DepartmentName;
         Id = _dao.Create(dep);
     }
     catch (Exception ex)
     {
         ErrorRoutine(ex, "DepartmentViewModel", "Create");
     }
 }
Exemple #4
0
 public void Create()
 {
     try
     {
         Department dept = new Department();
         dept.DepartmentName = DepartmentName;
         dept.Version        = 1;
         Id = _dao.Create(dept).GetIdAsString();
     }
     catch (Exception ex)
     {
         ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "GetById");
     }
 }
Exemple #5
0
 public void Create()
 {
     try
     {
         Department dep = new Department();
         dep.DepartmentName = Name;
         dep.Version        = Version;
         dep = _dao.Create(dep);
         Id  = dep.GetIdAsString();
     }
     catch (Exception ex)
     {
         ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "Create");
     }
 }
 public void Create()
 {
     try
     {
         Department dept = new Department();
         dept.DepartmentName = DepartmentName;
         dept.Version        = Version;
         dept.SetManagerIdFromString(ManagerId);
         Id = _dao.Create(dept).GetIdAsString();
     }
     catch (Exception ex)
     {
         ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "Create");
     }
 }
Exemple #7
0
        public void DepartmentDAOCreateAndDeleteShouldReturnTrue()
        {
            bool          deleteOk = false;
            Department    dep      = new Department();
            DepartmentDAO dao      = new DepartmentDAO();

            dep.DepartmentName = "Human Resources";  // and some hardcoded data

            string newid = dao.Create(dep);

            if (newid.Length == 24) // new id's are a 24 byte hex string
            {
                deleteOk = dao.Delete(newid);
            }
            Assert.IsTrue(deleteOk);
        }