Exemple #1
0
        public void AddTwoItemsToList()
        {
            var todo = new TodoList(repository);

            todo.Add("task one");
            todo.Add("task two");
            var list = todo.List();

            Assert.Equal(2, list.Length);
            Assert.Equal("task one", list[0]);
            Assert.Equal("task two", list[1]);
        }
Exemple #2
0
        public void RemoveDeletesItemFromList()
        {
            var todo = new TodoList(repository);

            todo.Add("task one");
            todo.Add("task two");
            todo.Add("task three");
            todo.Remove(1);
            var list = todo.List();

            Assert.Equal(2, list.Length);
            Assert.Equal("task one", list[0]);
            Assert.Equal("task three", list[1]);
        }
Exemple #3
0
        public void CompleteMarksItemAsComplete()
        {
            var todo = new TodoList(repository);

            todo.Add("task one");
            todo.Add("task two");
            todo.Add("task three");
            todo.Complete(1);
            var list = todo.List();

            Assert.Equal("task one", list[0]);
            Assert.Equal("x task two", list[1]);
            Assert.Equal("task three", list[2]);
            Assert.Equal(3, list.Length);
        }
Exemple #4
0
        public void AddOneItemToList()
        {
            var todo = new TodoList(repository);

            todo.Add("task one");
            var list = todo.List();

            Assert.Single(list);
            Assert.Equal("task one", list[0]);
        }
Exemple #5
0
        public static void Main(string[] args)
        {
            var id = Guid.NewGuid();

            using (var list = new TodoList())
            {
                var item = list.Add("Stack the shelves!");
                Console.WriteLine($"{item.Name}: {item.Done}");

                item.MarkDone(string.Empty);

                Console.WriteLine($"{item.Name}: {item.Done}");

                var newItem = list.Get(item.Id);
                Console.WriteLine($"{newItem.Name}: {newItem.Done}");
                Console.ReadLine();
            }
        }
Exemple #6
0
 public void Execute(TodoList todo, string item)
 {
     todo.Add(item);
 }