public string AddTask(BO.Task task) { try { cmd = objDB.GetStoredProcCommand("prAddTask"); objDB.AddInParameter(cmd, "@Category", System.Data.DbType.Int32, task.Category); objDB.AddInParameter(cmd, "@Status", System.Data.DbType.Int32, task.Status); objDB.AddInParameter(cmd, "@Description", System.Data.DbType.String, task.Description); objDB.AddInParameter(cmd, "@Notes", System.Data.DbType.String, task.Notes); objDB.AddInParameter(cmd, "@AssignTo", System.Data.DbType.Int32, task.AssignTo); objDB.AddInParameter(cmd, "@NotifyAssignee", System.Data.DbType.Boolean, task.NotifyAssignee); objDB.AddInParameter(cmd, "@Reminder", System.Data.DbType.Int32, task.Reminder); objDB.AddInParameter(cmd, "@ContactId", System.Data.DbType.Int32, task.ContactId); objDB.AddInParameter(cmd, "@DueDate", System.Data.DbType.DateTime, task.DueDate); objDB.AddInParameter(cmd, "@CreatedBy", System.Data.DbType.Int32, task.CreatedBy); objDB.ExecuteNonQuery(cmd); return("Success"); } catch (Exception ex) { throw ex; } finally { } }
public void CreateTaskDueInHoursTest() { const string title = "Meine Aufgabe"; var um = new UserManager("CreateTaskTestUser", true); um.InitDefaultTasks(); var tm = new TaskManager(um.CurrentUser.UserID); var cm = new CategoryManager(um.CurrentUser.UserID); var t = new BO.Task(); t.Title = title; t.CategoryID = cm.GetCategorySet().ElementAt(0).CategoryID; t.Due = DateTime.Now.AddDays(3).AddHours(-2); tm.CreateTask(t); Assert.True(t.TaskID > 0); Assert.Equal(title, t.Title); // Default Value Test: not supported in InMem-DB Assert.Equal(70.0, t.DueInHours); // Computed Column Test: not supported in InMem-DB }
public void CreateTaskDueInDaysTest() { Skip.If(Util.IsInMemory, "Only runs as integration test as the InMem-DB does not support Default Values and Computed Columns!"); var um = new UserManager("CreateTaskTestUser", true); um.InitDefaultTasks(); var tm = new TaskManager(um.CurrentUser.UserID); var cm = new CategoryManager(um.CurrentUser.UserID); var t = new BO.Task(); t.CategoryID = cm.GetCategorySet().ElementAt(0).CategoryID; t.Due = DateTime.Now.AddDays(3).AddHours(-2); tm.CreateTask(t); Assert.True(t.TaskID > 0); Assert.Equal(BO.Task.DefaultTitle, t.Title); // Default Value Test: not supported in InMem-DB Assert.Equal(3, t.DueInDays); // Computed Column Test: not supported in InMem-DB }