Esempio n. 1
0
        /// <summary>
        /// Displays the TodoEdit form to edit the selected Todo item selected in the TodoList grid.  If the Todo item is modified it will be updated
        /// in the TodoList data model object and grid, as well as marks to be updated in its underlying data source.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditTodoItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridTodoList.SelectedRows.Count == 0)
                {
                    return;
                }

                DataGridViewRow rowTodoItem = gridTodoList.SelectedRows[0];
                TodoItem        item        = m_TodoList.GetItem((int)rowTodoItem.Cells["TodoID"].Value);

                frmTodoEdit TodoEditForm = new frmTodoEdit(frmTodoEdit.TodoEditFormType.EditItem, item);

                if (TodoEditForm.ShowDialog() == DialogResult.OK)
                {
                    UpdateTodoGridRow(rowTodoItem, item);
                    m_blTodoListModified = true;
                }//end if
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in btnEditTodoItem_Click function of frmMain form.");
            }
        }
Esempio n. 2
0
        public void ChangeName_ShouldReplaceOriginal()
        {
            var item = new TodoItem(name);

            list.AddItem(item);
            list.UpdateItemName(name, newName);

            Assert.Equal(1, list.ItemCount);
            Assert.Equal(newName, list.GetItem(newName).Name);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public void ChangeTodoList_AddTodoItemToTodoList()
        {
            TodoList todoList = new TodoList(m_TodoItems, false);

            //Create new Todo Item
            TodoItem item = new TodoItem
            {
                Task       = "Contact attorney about BAA agreement with Sacred Star hospital.",
                Deadline   = new DateTime(2017, 2, 15),
                Completed  = false,
                Details    = "Sacred Star hospital has requested a new BAA agreement and we need to contact Mr. Mandell to look over the agreement.",
                UserID     = 1,
                ItemStatus = TodoModelItemStatus.New
            };

            int iTodoItemCount = todoList.Count;

            Assert.AreEqual(3, iTodoItemCount);

            //Add new Todo Item to mock TodoList repository.
            todoList.AddItem(item);

            iTodoItemCount = todoList.Count;
            Assert.AreEqual(4, iTodoItemCount);

            //Verify new Todo Item has been added to list and has a new TodoId assigned.
            TodoItem itemTest = todoList.GetItem(item.TodoID);

            Assert.IsNotNull(itemTest);
            Assert.IsInstanceOfType(item, typeof(TodoItem));
            Assert.IsTrue(item.Task.Contains("Sacred Star"));
            Assert.IsTrue(item.ItemStatus == TodoModelItemStatus.New);
        }
Esempio n. 5
0
        internal static TodoItem GetItemFromUser(TodoList todoList)
        {
            var context = "Something";

            context += "etohn";
            var todoId = GetInt("For which item?");

            return(todoList.GetItem(todoId));
        }
Esempio n. 6
0
        public void ChangeTodoList_ModifyTodoItemInTodoList()
        {
            TodoList todoList = new TodoList(m_TodoItems, false);

            int iTodoID = 3;

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

            //Modify properties of the Todo Item
            item.Task       = "Contact Touron International for Neuron Regeneration";
            item.Deadline   = new DateTime(2021, 12, 07);
            item.ItemStatus = TodoModelItemStatus.Modified;

            //Verify changes by requering Todo Item in mock TodoList repository.
            TodoItem itemTest = todoList.GetItem(iTodoID);

            Assert.IsNotNull(itemTest);
            Assert.AreEqual("Contact Touron International for Neuron Regeneration", itemTest.Task);
            Assert.AreEqual(new DateTime(2021, 12, 07), item.Deadline);
            Assert.IsTrue(itemTest.ItemStatus == TodoModelItemStatus.Modified);
        }