Exemplo n.º 1
0
        public void TestUpdate()
        {
            TaskManagerController taskManagerController = new TaskManagerController();

            taskManagerController.AddTask(new Models.Task()
            {
                Name = "TestUpdate1", StartDate = DateTime.Now.ToShortDateString(), EndDate = DateTime.Now.AddDays(10).ToShortDateString(), ParentId = 1, Priority = 10
            });
            IEnumerable <Task> tasks = taskManagerController.GetAllTasks();

            Assert.IsNotNull(tasks);
            Task   task    = tasks.Where(t => t.Name == "TestUpdate1").FirstOrDefault();
            string newName = task.Name + "Renamed";

            task.Name = newName;

            task.StartDate = DateTime.ParseExact(task.StartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)
                             .ToString("MM/dd/yyyy", CultureInfo.InvariantCulture).ToString();
            task.EndDate = DateTime.ParseExact(task.EndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)
                           .ToString("MM/dd/yyyy", CultureInfo.InvariantCulture).ToString();

            taskManagerController.UpdateTask(task);
            task = taskManagerController.GetTask(task.TaskId);
            Assert.IsTrue(task.Name == newName);
        }
        public void TestAddTask()
        {
            var apiController = new TaskManagerController();
            IHttpActionResult actionResult = apiController.AddTask("FSD Capsule", null, 10, Convert.ToDateTime("2018-08-08"), Convert.ToDateTime("2018-10-10"));

            Assert.IsNotNull(actionResult);
            Assert.AreEqual(HttpStatusCode.Created, ((System.Web.Http.Results.StatusCodeResult)actionResult).StatusCode);
        }
Exemplo n.º 3
0
        public void TestUpdate()
        {
            TaskManagerController testing = new TaskManagerController();

            testing.AddTask(new TaskManager.Entities.TASK()
            {
                TaskName = "UnitTesting", task_priority = 1
            });
        }
Exemplo n.º 4
0
        public void TestGetAll()
        {
            TaskManagerController testing = new TaskManagerController();

            testing.AddTask(new TaskManager.Entities.TASK()
            {
                TaskName = "GetAll1", task_priority = 1, parent_id = 1008
            }
                            );
            testing.AddTask(new TaskManager.Entities.TASK()
            {
                TaskName = "GetAll2", task_priority = 1, parent_id = 1008
            }
                            );
            IEnumerable <TaskManager.Entities.task_view> tasks = testing.ReadAllTasks();

            Assert.IsNotNull(tasks);
        }
Exemplo n.º 5
0
        public void Test_AddTask()
        {
            TaskManagerController ctrl = new TaskManagerController();

            TaskDetailsModel task = new TaskDetailsModel();

            task.ParentTaskName = "Task1";

            ctrl.AddTask(task);
        }
Exemplo n.º 6
0
        public void TestGet()
        {
            TaskManagerController taskManagerController = new TaskManagerController();

            taskManagerController.AddTask(new Models.Task()
            {
                Name = "GetTask1", StartDate = DateTime.Now.ToShortDateString(), EndDate = DateTime.Now.AddDays(10).ToShortDateString(), ParentId = 1, Priority = 10
            });
            taskManagerController.AddTask(new Models.Task()
            {
                Name = "GetTask2", StartDate = DateTime.Now.ToShortDateString(), EndDate = DateTime.Now.AddDays(10).ToShortDateString(), ParentId = 1, Priority = 10
            });
            IEnumerable <Task> tasks = taskManagerController.GetAllTasks();

            Assert.IsNotNull(tasks);
            int  taskId = tasks.FirstOrDefault().TaskId;
            Task task   = taskManagerController.GetTask(taskId);

            Assert.IsNotNull(task);
        }
Exemplo n.º 7
0
        public void TestAdd()
        {
            TaskManagerController taskManagerController = new TaskManagerController();

            taskManagerController.AddTask(new Models.Task()
            {
                Name = "AddTask", StartDate = DateTime.Now.ToShortDateString(), EndDate = DateTime.Now.AddDays(10).ToShortDateString(), ParentId = 1, Priority = 10
            });
            IEnumerable <Task> tasks = taskManagerController.GetAllTasks();

            Assert.IsNotNull(tasks);
            Assert.IsNotNull(tasks.Where(t => t.Name == "AddTask").First());
        }
Exemplo n.º 8
0
        public void BenchmarkAddTask()
        {
            TaskDetailsModel task = new TaskDetailsModel();

            task.TaskName       = "Task" + index.ToString();
            task.StartDate      = DateTime.Now;
            task.EndDate        = DateTime.Now.AddDays(15);
            task.IsEnded        = false;
            task.ParentTaskName = "Parent Task" + index.ToString();
            task.Priority       = 1;
            index++;
            _ctrl.AddTask(task);
        }
Exemplo n.º 9
0
        public void TestGet()
        {
            TaskManagerController testing = new TaskManagerController();

            testing.AddTask(new TaskManager.Entities.TASK()
            {
                TaskName = "Get1", task_priority = 1, parent_id = 1008
            }
                            );
            testing.AddTask(new TaskManager.Entities.TASK()
            {
                TaskName = "Get2", task_priority = 1, parent_id = 1008
            }
                            );
            IEnumerable <TaskManager.Entities.task_view> tasks = testing.ReadAllTasks();

            Assert.IsNotNull(tasks);
            int taskid = tasks.FirstOrDefault().TASK_ID;

            TaskManager.Entities.task_view task = testing.ReadTask(taskid);
            Assert.IsNotNull(task);
        }
        public void Test_AddTask()
        {
            TaskManagerController ctrl = new TaskManagerController();

            TaskDetailsModel task = new TaskDetailsModel();

            task.TaskName       = "Task2500";
            task.StartDate      = DateTime.Now;
            task.EndDate        = DateTime.Now.AddDays(15);
            task.IsEnded        = false;
            task.ParentTaskName = "Parent Task2";
            task.Priority       = 1;

            ctrl.AddTask(task);
        }
Exemplo n.º 11
0
        public void AddTaskTest()
        {
            var controller = new TaskManagerController();

            controller.Request       = new HttpRequestMessage();
            controller.Configuration = new HttpConfiguration();

            Task task = new Task();

            task.TaskDesc     = "NUnit Task";
            task.Priority     = 10;
            task.StartDate    = Convert.ToDateTime("2018-06-01");
            task.EndDate      = Convert.ToDateTime("2018-06-30");
            task.ParentTaskID = 1;

            string result = controller.AddTask(task);

            Assert.AreEqual("Record added Successfully", result);
        }