Exemple #1
0
        public void TaskType_Make_New_Assign_Tasks_And_Remove()
        {
            TaskType tt = new TaskType();
            tt.Alias = Guid.NewGuid().ToString("N");
            tt.Save();
            Assert.IsTrue(tt.Id > 0);

            Task t = new Task();
            t.Comment = Guid.NewGuid().ToString("N");
            t.Node = Document.GetRootDocuments().First();
            t.ParentUser = m_User;
            t.User = m_User;
            t.Type = TaskType.GetAll().First();
            t.Save();

            //delete the task type
            tt.Delete();

            //ensure they're gone
            Assert.AreEqual(0, Task.GetTasksByType(tt.Id).Count);

            //ensure the type is gone
            Assert.AreEqual(0, TaskType.GetAll().Where(x => x.Id == tt.Id).Count());

        }
Exemple #2
0
        public void TaskType_Make_Duplicate()
        {
            var alias = Guid.NewGuid().ToString("N");

            var tt = new TaskType();
            tt.Alias = alias;
            tt.Save();

            //try to insert a duplicate
            var tt2 = new TaskType();
            tt2.Alias = alias;
            var hasException = false;
            try
            {
                tt2.Save();
            }
            catch (SqlHelperException)
            {
                hasException = true;
            }
            Assert.IsTrue(hasException);

            //try to update to a duplicate
            var tt3 = new TaskType();
            tt3.Alias = Guid.NewGuid().ToString("N");
            tt3.Save();
            tt3.Alias = alias;
            hasException = false;
            try
            {
                tt3.Save();
            }
            catch (SqlHelperException)
            {
                hasException = true;
            }
            Assert.IsTrue(hasException);

            //now remove the ones we've created
            tt.Delete();
            tt3.Delete();

        }
Exemple #3
0
 public void TaskType_Not_Found_Constructor1()
 {
     TaskType u = new TaskType(-1111);
 }
Exemple #4
0
 public void TaskType_Not_Found_Constructor2()
 {
     TaskType u = new TaskType(Guid.NewGuid().ToString("N"));
 }
Exemple #5
0
 private void PopulateTaskFromReader(IRecordsReader dr)
 {
     _id = dr.GetInt("id");
     Type = new TaskType((int)dr.GetByte("taskTypeId"));
     Node = new CMSNode(dr.GetInt("nodeId"));
     ParentUser = User.GetUser(dr.GetInt("parentUserId"));
     User = User.GetUser(dr.GetInt("userId"));
     Date = dr.GetDateTime("DateTime");
     Comment = dr.GetString("comment");
     Closed = dr.GetBoolean("closed");
 }