Пример #1
0
        public void TestConvertPriorityToString()
        {
            Todo todo = new Todo("Test this method", Data.Models.Enums.Priority.High);

            string todoPriority = TaskPropertiesConverter.ConvertPriorityToString(todo);

            Assert.AreEqual("High", todoPriority);
        }
Пример #2
0
        public IActionResult GetTodos()
        {
            try
            {
                List <Todo>          todos     = TaskQuery.GetTodos();
                List <TodoViewModel> todoViews = new List <TodoViewModel>();
                foreach (Todo todo in todos)
                {
                    TodoViewModel todoViewModel = new TodoViewModel(todo.Id, todo.TaskName, TaskPropertiesConverter.ConvertPriorityToString(todo));
                    todoViews.Add(todoViewModel);
                }

                return(Ok(todoViews));
            }
            catch (Exception exception)
            {
                return(Problem(exception.Message));
            }
        }