public void ZTaskManager_GetAndUpdateCurrentTask()
        {
            // Arrange
            foreach (ITask task in tasks)
            {
                manager.PushTask(task);
            }

            ITask          lastTask   = tasks[tasks.Count - 1];
            ZScheduledTask mostUrgent = pTasks[0];

            // Select the most urgent task
            int priorityListLength = pTasks.Count;

            for (int i = 1; i < priorityListLength; ++i)
            {
                if (pTasks[i].GetUrgentDate() < mostUrgent.GetUrgentDate())
                {
                    mostUrgent = pTasks[i];
                }
            }


            // Assume
            Assume.That(manager.CurrentTask, Is.EqualTo(lastTask));

            // Act I - push priority
            foreach (var task in pTasks) // tasks with priority
            {
                manager.PushTaskWithPriority(task);
            }

            // Assert I - Current Task is still stale
            Assert.That(manager.CurrentTask, Is.EqualTo(lastTask));

            // Act II - update Current Task
            manager.Update();

            // Assert II - Current Task is updated
            Assert.That(manager.CurrentTask, Is.EqualTo(mostUrgent));
        }
        /// <summary>
        /// return true if the command is quit;
        /// </summary>
        /// <param name="commands"></param>
        /// <returns></returns>
        public bool ProcessCommand(string[] commands)
        {
            string mainCommand = commands[0];

            ConsoleStatus status = ConsoleStatus.OK;

            try
            {
                switch (mainCommand)
                {
                case Quit:     // Quit the program
                    return(true);

                case Save:
                    manager.Save();
                    Print("Tasks saved to disk ...");
                    break;

                case HelpKey:
                    executor.PrintHelpMenu(commands);
                    break;

                case Add:     // Adding a new task
                    status = executor.AddNewTask(commands);
                    if (IsQuit(status))
                    {
                        return(true);
                    }
                    break;

                case CurTask:
                    executor.PrintCurrentTask();
                    break;

                case PutOffCurrent:
                    executor.PutOffCurrentTask(commands);
                    break;

                case ArchiveCurrent:
                    executor.ArchiveCurrentTask(commands);
                    break;

                case Update:
                    manager.Update();
                    Print("Update Successful ...");
                    break;

                case DeprioritizeCurrent:
                    manager.DeprioritizeCurrentTask();
                    Print($"Current Task '{manager.CurrentTask.Title}' Is Deprioritized ...");
                    break;

                case PrioritizeCurrent:
                    manager.PrioritizeCurrentTask();
                    Print($"Current Task '{manager.CurrentTask.Title}' Is Prioritized ...");
                    break;

                case UnscheduleCurrent:
                    manager.UnscheduleCurrentTask();
                    Print($"Current Task '{manager.CurrentTask.Title}' Is Unscheduled ...");
                    break;

                case ScheduleCurrent:
                    status = executor.ScheduleCurrentTask();
                    if (IsQuit(status))
                    {
                        return(true);
                    }
                    Print($"Current Task '{manager.CurrentTask.Title}' is successfully scheduled ...");
                    break;

                case StretchCurrentDeadline:
                    status = executor.StretchCurrentTaskDeadline();
                    if (IsQuit(status))
                    {
                        return(true);
                    }
                    break;

                case ResetCurrentDeadline:
                    status = executor.ResetCurrentTaskDeadline();
                    if (IsQuit(status))
                    {
                        return(true);
                    }
                    break;

                case ResetCurrentBuffer:
                    status = executor.ResetCurrentTaskBuffer();
                    if (IsQuit(status))
                    {
                        return(true);
                    }
                    break;

                case EditCurrentTitle:
                    status = executor.EditCurrentTaskTitle();
                    if (IsQuit(status))
                    {
                        return(true);
                    }
                    break;

                case EditCurrentDescription:
                    status = executor.EditCurrentTaskDescription();
                    if (IsQuit(status))
                    {
                        return(true);
                    }
                    break;

                case ViewAllTasks:
                    executor.View_AllTasks(commands);
                    break;

                case ViewSelect:     // select certain tasks to view
                    executor.View_SelectedTasks(commands);
                    break;

                case ViewArchive:     // should implement -detail flag detector later
                    executor.View_Archives(commands);
                    break;

                default:
                    throw new BadCommandException($"Command '{mainCommand}' is not recognized");
                }
            }
            catch (BadFileParsingException e)
            {
                PrintWarning(Help.CorruptFileInstruction);
                ZDebugUtil.PrintError(e);
            }
            catch (BadCommandException e)
            {
                PrintWarning(Help.BadCommandInstruction);
                ZDebugUtil.PrintError(e);
            }
            catch (Exception e)
            {
                ZDebugUtil.PrintError(e);
            }
            return(false);
        }