public void Test_H_DeleteTask() { TaskBL obj = new TaskBL(); obj.DeleteTask(AddDelTestId); Assert.IsNull(obj.GetById(AddDelTestId)); }
public async System.Threading.Tasks.Task GetTaskById() { TaskBL obj = new TaskBL(); List <Task> Ts = obj.GetAll(); var tasks = await obj.GetById(Ts[0].TaskId); Assert.IsNotNull(tasks); }
public void Test_E_GetById() { //int id = 3; TaskBL obj = new TaskBL(); var TestTask = obj.GetById(id); Assert.AreEqual(TestTask.TaskId, id); }
public async Task <IHttpActionResult> Get(int id) { Entities.Task task = await taskobj.GetById(id); if (task == null) { return(Ok("Task Not Found")); } return(Ok(task)); }
private void FillFields() { var idTask = (int)IdTask; var vModel = (TaskModel)taskBL.GetById(idTask); if (vModel != null) { Title = vModel.Title; Description = vModel.Description; DueDate = vModel.DueDate.ToString("dd/MM/yyyy"); } }
public async System.Threading.Tasks.Task DeleteTask() { TaskBL obj = new TaskBL(); List <Task> Ts = obj.GetAll(); int count = obj.GetAll().Count(); var tasks = await obj.GetById(Ts[0].TaskId); await obj.DeleteTask(tasks.TaskId); int count1 = obj.GetAll().Count(); Assert.AreEqual(count - 1, count1); }
public async System.Threading.Tasks.Task UpdateTask() { TaskBL obj = new TaskBL(); List <Task> Ts = obj.GetAll(); var tasks = await obj.GetById(Ts[0].TaskId); Task tsk = new Task { TaskId = tasks.TaskId, TaskName = "New Test Task", ParentTaskName = "New Test Parent Task", Priority = 5, IsTaskEnded = false, SDate = DateTime.Now, EDate = DateTime.Now.AddDays(2) }; await obj.UpdateTask(tsk); //int count1 = obj.GetAll().Count(); string tskName = "New Test Task"; Assert.AreEqual(tskName, tsk.TaskName); }
public IHttpActionResult GetTaskById(int taskId) { var taskBL = new TaskBL(_context); var task = taskBL.GetById(taskId); var formatTask = new { TaskId = task.TaskId, TaskName = task.TaskName, Priority = task.Priority, StartDate = task.StartDate.ToString("yyyy-MM-dd"), EndDate = task.EndDate.ToString("yyyy-MM-dd"), ParentId = task.ParentId }; return(Ok(formatTask)); }
static void Main(string[] args) { try { string input; Console.WriteLine("Select the Action No."); Console.WriteLine("1.Add Task"); Console.WriteLine("2.Update Task"); Console.WriteLine("3.Search Task"); Console.WriteLine("4.Delete Task"); Console.WriteLine("5.Exit"); input = Console.ReadLine(); TaskBL obj = new TaskBL(); switch (input) { case "1": obj.AddTask(new TaskManager.Entities.Task() { TaskId = 2, TaskName = "Task22", ParentTask = "Task11", Priority = 2, SDate = DateTime.Now, EDate = DateTime.Now, TaskEndFlag = true }); break; case "2": Console.WriteLine("Enter Task Id"); string ID_Update = Console.ReadLine(); TaskManager.Entities.Task TskUpdate = obj.GetById(Convert.ToInt32(ID_Update)); Console.WriteLine("Task Details Before Update:"); Console.WriteLine("Task ID : " + TskUpdate.TaskId.ToString() + "\n" + "Task Name : " + TskUpdate.TaskName.ToString() + "\n" + "Priority : " + TskUpdate.Priority.ToString() + "\n"); Console.WriteLine("Enter New TaskName"); TskUpdate.TaskName = Console.ReadLine(); obj.UpdateTask(TskUpdate); TskUpdate = obj.GetById(Convert.ToInt32(ID_Update)); Console.WriteLine("Task Details After Update:"); Console.WriteLine("Task ID : " + TskUpdate.TaskId.ToString() + "\n" + "Task Name : " + TskUpdate.TaskName.ToString() + "\n" + "Priority : " + TskUpdate.Priority.ToString() + "\n"); Console.ReadLine(); break; case "3": Console.WriteLine("Enter Task Id to Search"); String ID = Console.ReadLine(); TaskManager.Entities.Task TskSearch = obj.GetById(Convert.ToInt32(ID)); Console.WriteLine("Task Details:"); Console.WriteLine("Task ID : " + TskSearch.TaskId.ToString() + "/n" + "Task Name : " + TskSearch.TaskName.ToString() + "/n" + "Priority : " + TskSearch.Priority.ToString() + "/n" ); break; case "4": Console.WriteLine("Enter Task Id to Delete"); String ID_Del = Console.ReadLine(); obj.DeleteTask(Convert.ToInt32(ID_Del)); break; case "5": break; default: break; } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadLine(); } }
public IHttpActionResult Search(int Id) { TaskBL obj = new TaskBL(); return(Ok(obj.GetById(Id))); }
public void GetById() { var task = taskBL.GetById(1); Assert.IsNotNull(task); }