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 AddTask()
        {
            TaskBL obj   = new TaskBL();
            int    count = obj.GetAll().Count();
            Task   tsk   = new Task {
                TaskName = "Test Task", ParentTaskName = "Test Parent Task", Priority = 2, IsTaskEnded = false, SDate = DateTime.Now, EDate = DateTime.Now.AddDays(2)
            };
            await obj.Add(tsk);

            int count1 = obj.GetAll().Count();

            Assert.AreEqual(count + 1, count1);
        }
        public void GetAll()
        {
            TaskBL obj   = new TaskBL();
            int    count = obj.GetAll().Count();

            Assert.Greater(count, 0);
        }
        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 MainWindowCommand()
        {
            taskBL = new TaskBL(ConnectionStringSingleton.Instance.ConnectionString);
            TasksSingleton.Instance.Tasks = new ObservableCollection <TaskModel>(taskBL.GetAll().OrderBy(t => t.DueDate));
            Tasks = TasksSingleton.Instance.Tasks;

            NewTaskCommand      = new RelayCommand(NewTask);
            EditTaskCommand     = new RelayCommand(EditTask);
            CompleteTaskCommand = new RelayCommand(CompleteTask);
            DeleteTaskCommand   = new RelayCommand(DeleteTask);
            FilterCommand       = new RelayCommand(FilterTask);
        }
        public void Test_C_GetAll()
        {
            TaskBL obj       = new TaskBL();
            var    TestTasks = obj.GetAll();

            TaskCount = TestTasks.Count;
            if (TaskCount > 0)
            {
                id   = TestTasks[0].TaskId;
                Name = TestTasks[0].TaskName;
            }
            Assert.NotZero(TaskCount);
        }
        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);
        }
Ejemplo n.º 8
0
        public void GetTaskTestBL()
        {
            Mock <TaskDBEntities> mockContext = MockSP();
            var taskManagerBL        = new TaskBL(mockContext.Object);
            List <TaskDetails> tasks = taskManagerBL.GetAll();

            Assert.IsNotNull(tasks);
            foreach (var task in tasks)
            {
                Assert.IsNotNull(task.TaskId);
                Assert.IsNotNull(task.Task_Name);
                Assert.IsNotNull(task.priority);
                Assert.IsNotNull(task.StartDate);
                Assert.IsNotNull(task.EndDate);
            }
        }
Ejemplo n.º 9
0
 public IHttpActionResult Get()
 {
     return(Ok(taskobj.GetAll()));
 }
        //[Route("GetAll")]
        //[HttpGet]
        public IHttpActionResult Get()
        {
            TaskBL obj = new TaskBL();

            return(Ok(obj.GetAll()));
        }
 public void Test_Perf_GetAllTask()
 {
     TaskBL obj       = new TaskBL();
     var    TestTasks = obj.GetAll();
 }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            try
            {
                string input;
                //Database.SetInitializer(new DropCreateDatabaseIfModelChanges<ProjectManagerContext>());
                //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();
                List <Task> abc = obj.GetAll();
                foreach (Task t in abc)
                {
                    Console.WriteLine(t.TaskId);
                }
                ProjectBL      obj2 = new ProjectBL();
                List <Project> abc2 = obj2.GetAll();
                foreach (Project t in abc2)
                {
                    Console.WriteLine(t.ProjectId);
                }
                UserBL      obj3 = new UserBL();
                List <User> abc3 = obj3.GetAll();
                foreach (User t in abc3)
                {
                    Console.WriteLine(t.UserId);
                }
                Console.ReadLine();


                //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();
            }
        }
Ejemplo n.º 13
0
 public IEnumerable <TaskDetails> Get()
 {
     return(bl.GetAll());
 }
Ejemplo n.º 14
0
        public void GetAll()
        {
            var tasks = taskBL.GetAll();

            Assert.IsNotNull(tasks);
        }