Exemplo n.º 1
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));
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
        public void Test_New_IsTheSameAsAdd()
        {
            TaskManTester tester = new TaskManTester();

            tester.RunWithCommands(
                "add Remember the milk",
                "new Remember the milk");

            Assert.That(tester.SavedTasks.Count(), Is.EqualTo(2));
            Assert.That(
                tester.SavedTasks.First().Description,
                Is.EqualTo(tester.SavedTasks.Last().Description));
        }
Exemplo n.º 4
0
        public void Test_PriorityFlag_FiltersByPriority()
        {
            TaskManTester tester = new TaskManTester();

            tester.RunWithCommands(
                "add first",
                "add second -p Important",
                "add third",
                "delete -p Normal");

            Assert.That(
                tester.SavedTasks.Single().Priority,
                Does.Not.EqualTo(Priority.Normal));
        }
Exemplo n.º 5
0
        public void Test_DescriptionRegexFlag_FiltersTasksByDescription()
        {
            TaskManTester tester = new TaskManTester();

            tester.RunWithCommands(
                "add mario --silent",
                "add wario --silent",
                "add princess --silent",
                "add bowser --silent",
                "show --like ario");

            Assert.That(
                tester.Output,
                Does.Contain("mario")
                .And.Contain("wario")
                .And.Not.Contain("princess")
                .And.Not.Contain("bowser"));
        }
Exemplo n.º 6
0
        public void Test_Renumber_RenumbersTasksInGivenOrder()
        {
            TaskManTester tester = new TaskManTester();

            tester.RunWithCommands(
                "add 1",
                "add 2",
                "add 3");

            Assert.That(
                tester.SavedTasks.Select(t => t.Description),
                Is.EquivalentTo(new[] { "1", "2", "3" }));

            tester.RunWithCommand("renumber --orderby id-");

            Assert.That(
                tester.SavedTasks.Select(t => t.Description),
                Is.EquivalentTo(new[] { "3", "2", "1" }));
        }