//Performance checking for Adding new List item public void AddTaskTest() { Task task = new Task { Task_ID = 0, TaskName = "Task 9", Parent = null, Start_Date = DateTime.Now.AddDays(-10), End_Date = DateTime.Now.AddDays(5), Parent_ID = null, Priority = 10 }; blObj.AddTask(task); }
//Method used to add new task public IHttpActionResult AddTask([FromBody] Task newTask) { if (!ModelState.IsValid) { return(BadRequest()); } blObject = new TaskManagerBL(); blObject.AddTask(newTask); return(Ok()); }
// POST: api/TaskManager public void AddTask([FromBody] Task task) { TaskManagerBL taskManagerBL = new TaskManagerBL(); taskManagerBL.AddTask(new DA.Task() { Task1 = task.Name, Parent__ID = task.ParentId, Priority = task.Priority, End_Date = Convert.ToDateTime(task.EndDate), Start_Date = Convert.ToDateTime(task.StartDate) }); }
public IHttpActionResult AddTask([FromBody] TaskModel task) { TaskBL blTask = new TaskBL { Task = task.Task, ParentTask = task.ParentTask, Priority = task.Priority, StartDate = task.StartDate, EndDate = task.EndDate }; taskManagerBL.AddTask(blTask); return(Ok()); }
//Test Method for AddTask List Items public void AddTaskTest() { Task task = new Task { Task_ID = 0, TaskName = "Task 9", Parent = null, Start_Date = DateTime.Now.AddDays(-10), End_Date = DateTime.Now.AddDays(5), Parent_ID = null, Priority = 10 }; try { blObj.AddTask(task); Assert.IsTrue(1 == 1); } catch { Assert.Inconclusive("Task not added"); } }
public void Test_AddTask() { TaskModel objTsk = new TaskModel() { TaskName = "Task7", ParentTaskName = "ParentTask7", StartDate = new DateTime(2018, 09, 10), EndDate = new DateTime(2018, 09, 15), Priority = 11 }; Mock <ITaskDbService> mockDb = new Mock <ITaskDbService>(); TaskManagerBL obj = new TaskManagerBL(mockDb.Object); obj.AddTask(objTsk); mockDb.Verify(c => c.AddTask(It.IsAny <Task>()), Times.Once); }
public void AddTaskTest() { Mock <TaskManagerEntities> mockContext = MockDataSetList(); var taskManagerBL = new TaskManagerBL(mockContext.Object); TaskBL model = new TaskBL { Task = "Task 4", ParentTask = "Task 1", Priority = 5, StartDate = DateTime.Today, EndDate = DateTime.Today.AddDays(10) }; int result = taskManagerBL.AddTask(model); Assert.IsTrue(result == 0); }
public IHttpActionResult AddTask(String task, int?parentTask, Int16 priority, DateTime startDate, DateTime endDate) { DataLayer.Tasks t = new Tasks(); try { t.Task = task; t.Parent__ID = parentTask; t.Priority = priority; t.Start_Date = startDate; t.End_Date = endDate; taskBL.AddTask(t); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(StatusCode(HttpStatusCode.Created)); }