コード例 #1
0
        public void PutOffCurrentTask(string[] commands)
        {
            string title = null;

            switch (commands.Length)
            {
            case 1:
                title = manager.PutOffCurrentTask(new Random().Next(2, 4));
                break;

            case 2:
                string extent = commands[1];
                if (extent.Equals(ToBottomFlag))
                {
                    title = manager.PutOffCurrentTaskToBottom();
                }
                else
                {
                    title = manager.PutOffCurrentTask(int.Parse(extent));
                }
                break;

            default:
                throw new BadCommandException(commands);
            }
            Print($"Task '{title}' is successfully put off ...");
        }
コード例 #2
0
        public void ZTaskManager_PutOffCurrentTask(int by)
        {
            // Arrange
            foreach (var task in tasks)
            {
                manager.PushTask(task);
            }
            ITask lastTask = tasks[tasks.Count - 1];

            // Assume
            Assume.That(manager.CurrentTask, Is.EqualTo(lastTask));
            Assume.That(tasks.Count, Is.GreaterThanOrEqualTo(by));

            // Act
            manager.PutOffCurrentTask(by);

            // Assert
            for (int i = 0; i < by; ++i)
            {
                var t = manager.CurrentTask;
                manager.ArchiveCurrentTask(Category.Done);
            }

            Assert.That(manager.CurrentTask, Is.EqualTo(lastTask));
        }