Exemple #1
0
        private void AddDummyData()
        {
            TodoDataRetrieval _dataRetrieval = new TodoDataRetrieval();
            Todo item1 = new Todo()
            {
                Active      = true,
                TimeCreated = DateTime.Now,
                Title       = "item 1"
            };

            _todolist.Add(item1);
            Todo item2 = new Todo()
            {
                Active      = false,
                TimeCreated = DateTime.Now,
                Title       = "item 2"
            };

            _todolist.Add(item2);
            Todo item3 = new Todo()
            {
                Active      = true,
                TimeCreated = DateTime.Now,
                Title       = "item 3"
            };

            _todolist.Add(item3);
        }
Exemple #2
0
 internal void UpdateTodo(int index, Todo _currentodo)
 {
     _todolist      = AppSession.Instance.GetValue <List <Todo> >("todolist");
     _dataRetrieval = new TodoDataRetrieval();
     AppSession.Instance.RemoveValue("todolist");
     AppSession.Instance.SetValue("todolist", _dataRetrieval.TodoUpdate(index, _currentodo, _todolist));
 }
Exemple #3
0
 internal void SaveNewTodo(Todo _currentodo)
 {
     _todolist      = AppSession.Instance.GetValue <List <Todo> >("todolist");
     _dataRetrieval = new TodoDataRetrieval();
     AppSession.Instance.RemoveValue("todolist");
     AppSession.Instance.SetValue("todolist", _dataRetrieval.TodoInsert(_currentodo, _todolist));
 }
        internal void DeactivateTodo(Todo selecteditem)
        {
            _todolist      = AppSession.Instance.GetValue <List <Todo> >("todolist");
            _dataRetrieval = new TodoDataRetrieval();
            int index = _todolist.IndexOf(selecteditem);

            AppSession.Instance.RemoveValue("todolist");
            AppSession.Instance.SetValue("todolist", _dataRetrieval.TodoDeactivateActivate(index, _todolist));
        }
Exemple #5
0
        public void TodoInsert_Test()
        {
            TodoDataRetrieval _dataRetrieval = new TodoDataRetrieval();
            Todo item = new Todo();

            _todolist.Clear();
            _todolist = _dataRetrieval.TodoInsert(item, _todolist);
            int count = _dataRetrieval.TodoCount(_todolist);

            Assert.AreEqual(count, 1);
        }
Exemple #6
0
        public void TodoRemove_Test()
        {
            TodoDataRetrieval _dataRetrieval = new TodoDataRetrieval();

            _todolist.Clear();
            AddDummyData();

            _todolist = _dataRetrieval.TodoRemove(1, _todolist);
            int count = _dataRetrieval.TodoCount(_todolist);

            Assert.AreEqual(count, 2);
        }
Exemple #7
0
        public void TodoGetAllInactive_Test()
        {
            TodoDataRetrieval _dataRetrieval = new TodoDataRetrieval();

            _todolist.Clear();
            AddDummyData();

            _todolist = _dataRetrieval.TodoGetAllInactive(_todolist);
            int count = _dataRetrieval.TodoCount(_todolist);

            Assert.AreEqual(count, 1);
        }
Exemple #8
0
        public void TodoUpdate_Test()
        {
            TodoDataRetrieval _dataRetrieval = new TodoDataRetrieval();

            _todolist.Clear();
            AddDummyData();

            Todo item4 = new Todo()
            {
                Title = "item4"
            };

            _todolist = _dataRetrieval.TodoUpdate(0, item4, _todolist);

            string title = _dataRetrieval.TodoGetAll(_todolist).First().Title;

            Assert.AreEqual(title, "item4");
        }
Exemple #9
0
        public void TodoDeactivateActivate_Test()
        {
            TodoDataRetrieval _dataRetrieval = new TodoDataRetrieval();

            _todolist.Clear();

            Todo item1 = new Todo()
            {
                Active = true
            };

            _todolist = _dataRetrieval.TodoInsert(item1, _todolist);

            int  _item1index = _todolist.IndexOf(item1);
            bool active      = _dataRetrieval.TodoDeactivateActivate(_item1index, _todolist).First().Active;

            Assert.AreEqual(active, false);
        }
 internal List <Todo> GetAllActiveTodos()
 {
     _todolist      = AppSession.Instance.GetValue <List <Todo> >("todolist");
     _dataRetrieval = new TodoDataRetrieval();
     return(_dataRetrieval.TodoGetAllActive(_todolist));
 }