示例#1
0
        public ActionResult addJob(AddJob job)
        {
            if (ModelState.IsValid)
            {
                return(Ok(service.AddJob(job.TaskId, job.JobName)));
            }

            return(BadRequest());
        }
示例#2
0
        public void testupdateJob_UpdateNameOfJob()
        {
            //Arrange
            AddTask addTask = new AddTask()
            {
                Task          = "Task 1",
                Description   = String.Empty,
                CompletedDate = DateTime.Now.ToString()
            };

            service.addNewTask(addTask);
            service.AddJob(1, "Job 1");

            //Act
            Task result = service.UpdateJobName(1, 1, "Job 2").First();

            //Assert
            Assert.AreEqual("Job 2", result.Jobs.First().Name);
        }
示例#3
0
        public void testDeleteJob_DeleteAJob()
        {
            //Arrange
            AddTask addTask = new AddTask()
            {
                Task          = "Task 1",
                Description   = String.Empty,
                CompletedDate = DateTime.Now.ToString()
            };

            service.addNewTask(addTask);

            service.AddJob(1, "Job 1");
            service.AddJob(1, "Job 2");

            //Act
            List <Task> result = service.DeleteJobById(1, 1);

            //Assert
            Assert.AreEqual(1, result.First().Jobs.Count());
        }