Example #1
0
        public void TodoItems_ShouldBeRetained()
        {
            var list = new TodoList("test list");

            list.AddItem(new TodoItem("test item 1"));
            list.AddItem(new TodoItem("test item 2"));
            lists.Insert(list);

            var retrieved = lists.FindOne(x => x.Name == "test list");

            Assert.Equal(2, retrieved.ItemCount);
        }
Example #2
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);
        }
Example #3
0
        public void AddDuplicateItem_ShouldThrowAlreadyExistsException()
        {
            var item = new TodoItem(name);

            list.AddItem(item);
            var sameItem = new TodoItem(name);

            Assert.Throws <TodoListAlreadyExistsException>(() => list.AddItem(sameItem));
        }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        if (hasEnabledFinalTodoListItem && disabledTodoListItem.isComplete && !loading)
        {
            loading = true;
            StartCoroutine(LoadCityScene());
        }

        if (todoList.IsComplete() && !hasEnabledFinalTodoListItem)
        {
            hasEnabledFinalTodoListItem = true;
            todoList.Clear();
            todoList.AddItem(disabledTodoListItem);
            disabledTodoListItem.gameObject.SetActive(true);
        }
    }
Example #5
0
        /// <summary>
        /// Adds a new Todo Item to the Todo List data model object and to the TodoList grid.  In addition, the TodoList item will be marked to be added
        /// to the underlying data source.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnNewTodoItem_Click(object sender, EventArgs e)
        {
            try
            {
                TodoItem    item         = m_TodoList.NewTodoItem();
                frmTodoEdit TodoEditForm = new frmTodoEdit(frmTodoEdit.TodoEditFormType.CreateItem, item);

                if (TodoEditForm.ShowDialog() == DialogResult.OK)
                {
                    m_TodoList.AddItem(item);
                    AddTodoGridRow(item);
                    m_blTodoListModified = true;
                }//end if
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in btnNewTodoItem_Click function of frmMain form.");
            }
        }
Example #6
0
        public ActionResult <IEnumerable <string> > Index()
        {
            var todoitems = _context.TodoItems.ToList();

            TodoList todoList = new TodoList();

            foreach (var item1 in todoitems)
            {
                todoList.AddItem(new TodoItem {
                    Id = item1.Id, Name = item1.Name, IsComplete = item1.IsComplete
                });

                Console.WriteLine(item1.Name);
            }
            Console.WriteLine(_context.GetType());
            Console.WriteLine("good morning");
            @ViewData["todoItems"] = todoitems;

            return(View(todoList));
        }