Beispiel #1
0
        public void ChangeTodoList_DeleteTodoItemFromTodoList()
        {
            TodoList todoList = new TodoList(m_TodoItems, false);

            int iTodoID = 2;

            //Find Todo Item by TodoID
            TodoItem item = todoList.GetItem(iTodoID);

            //Verifies Todo Item is contained in mock TodoList repository before deletion.
            int iTodoItemCount = todoList.Count;

            Assert.AreEqual(3, iTodoItemCount);
            Assert.IsTrue(todoList.Contains(iTodoID));

            //Delete Todo Item by specifying the item's TodoID
            todoList.DeleteItem(iTodoID);

            //Verifies Todo Item is no longer contained in mock TodoList repository after deletion.
            iTodoItemCount = todoList.Count;
            Assert.AreEqual(2, iTodoItemCount);
            Assert.IsFalse(todoList.Contains(iTodoID));

            //Verifies the Todo Item's modification status has been marked to delete.
            Assert.IsTrue(item.ItemStatus == TodoModelItemStatus.Deleted);
        }
        // delete from local collection and send request to cloud service
        public async void Delete(TaskTodo todoTask)
        {
            Debug.WriteLine("Testing DELETE from Model");
            if (TodoList.Contains(todoTask))
            {
                TodoList.Remove(todoTask);
                var status = storageService.deleteToDoTask(todoTask);

                if (status.Equals("FAIL"))
                {
                    await new MessageDialog("Deletion failed to process on server! /n Check if you have Internet connecton...").ShowAsync();
                }
                Debug.WriteLine("Deleting Task (TodoCollection) STATUS => " + status.ToString());
            }
        } // end of Delete()