Example #1
0
        public static void Main()
        {
            while (true)
            {
                Console.WriteLine(Menu);
                Console.Write("Choice: ");
                var response = Console.ReadLine();
                if (int.TryParse(response, out var choice))
                {
                    switch (choice)
                    {
                    case 1:
                        Console.Clear();
                        TodoHelper.PrintTodoTable(
                            Repo.GetPending());
                        break;

                    case 2:
                        Console.Clear();
                        AddItem();
                        Console.WriteLine("Done!\n\n");
                        break;

                    case 3:
                        Console.Clear();
                        CompleteItem();
                        Console.WriteLine("Done!\n\n");
                        break;

                    case 4:
                        Console.Clear();
                        TodoHelper.PrintTodoTable(
                            Repo.GetCompleted());
                        break;

                    case 5:
                        Console.Clear();
                        DeleteItem();
                        Console.WriteLine("Done!\n\n");
                        break;

                    case 0: return;

                    default: break;
                    }
                }
                else
                {
                    Console.WriteLine("Invalid Input. Choice must be between 0-5");
                    Console.WriteLine("-----------------------------------------\n\n");
                }
            }
        }
Example #2
0
        public void GetPendingTest()
        {
            ClearDb();
            _repo.Add(new Todo());
            _repo.Add(new Todo().Complete());
            _repo.Add(new Todo());

            Assert.Equal(2, _repo.GetPending().Count());
        }