Ejemplo n.º 1
0
        public void Test_Delete_DeletesTasks()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.RunWithCommand("delete --all");

            Assert.IsEmpty(tester.SavedTasks);
        }
Ejemplo n.º 2
0
        public void Test_FormatFlag_WorksWithXMLFormat()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.RunWithCommand("show --format xml");

            Assert.That(true);
        }
Ejemplo n.º 3
0
        public void Test_InteractiveFlag_AllowsTheUserToConfirmOperation()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.Input = "yes";

            tester.RunWithCommand("delete --all --interactive");

            Assert.That(tester.SavedTasks, Is.Empty);
        }
Ejemplo n.º 4
0
        public void Test_Update_UpdatesPriority()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.RunWithCommands("update --all priority Important");

            Assert.That(
                tester.SavedTasks,
                Is.All.Matches <Task>(task => task.Priority == Priority.Important));
        }
Ejemplo n.º 5
0
        public void Test_Update_UpdatesFinished()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.RunWithCommands("update --all finished true");

            Assert.That(
                tester.SavedTasks,
                Is.All.Matches <Task>(task => task.IsFinished));
        }
Ejemplo n.º 6
0
        public void Test_Update_UpdatesDescription()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.RunWithCommand("update --all description NEW");

            Assert.That(
                tester.SavedTasks,
                Is.All.Matches <Task>(task => task.Description == "NEW"));
        }
Ejemplo n.º 7
0
        public void Test_Complete_CompletesTasks()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.RunWithCommand("complete --all");

            Assert.That(
                tester.SavedTasks,
                Is.All.Matches <Task>(task => task.IsFinished));
        }
Ejemplo n.º 8
0
        public void Test_TaskMan_RequiresExplicitFilteringOnDelete()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();

            tester.RunWithCommand("delete");

            Assert.That(tester.SavedTasks.Any());
            Assert.That(
                tester.Errors.ContainsFormat(Messages.NoFilterConditionsUseAllIfIntended));
        }
Ejemplo n.º 9
0
        public void Test_InteractiveFlag_AllowsTheUserToAbortOperation()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.Input = "no";

            tester.RunWithCommand("delete --all --interactive");

            Assert.That(() => tester.Output.ContainsFormat(Messages.Cancelled));
            Assert.That(tester.SavedTasks.Count, Is.EqualTo(3));
        }
Ejemplo n.º 10
0
        public void Test_LimitFlag_HasLowerPriorityThanSkipFlag()
        {
            TaskManTester tester = new TaskManTester();

            tester.AddThreeTasks();
            tester.RunWithCommand("show --limit 1 --skip 2");

            Assert.That(
                tester.Output,
                Does.Not.Contain("first")
                .And.Not.Contain("second")
                .And.Contains("third"));
        }