public void When_UpdateTask_Then_VerifyResults() { var project = TestDataHelper.GetTask().Map(); project.TaskId = 10; var result = controller.UpdateTask(project); Assert.NotNull(result); project.TaskId = 0; result = controller.UpdateTask(project); Assert.NotNull(result); }
public void UpdateTaskTest_IterationsMode() { Tasks newTask = new Tasks() { TaskId = 5, Task = "Task5", ProjectId = 1, ParentTaskId = 1, Priority = 7, StartDate = new DateTime(), EndDate = new DateTime(), UserId = 1, IsEnded = true }; var result = tb.UpdateTask(newTask) as OkNegotiatedContentResult <string>; }
public void When_UpdateAnExistingTask_Then_HttpOK() { //Arrange var task = ProjectManagerFakeData.TaskFakeData.Project1_ParentTask1.DeepCopy() as TaskModel; task.TaskDescription = "Description Updated"; // Act var result = Controller.UpdateTask(task); // Assert Assert.IsNotNull(result); Assert.IsInstanceOf <StatusCodeResult>(result); var castedResult = result as StatusCodeResult; Assert.AreEqual(HttpStatusCode.OK, castedResult.StatusCode); }
public void UpdateTaskTest() { Tasks newTask = new Tasks() { TaskId = 5, Task = "Task5", ProjectId = 1, ParentTaskId = 1, Priority = 7, StartDate = new DateTime(), EndDate = new DateTime(), UserId = 1, IsEnded = true }; ProjectManagerController tb = new ProjectManagerController(dbContext.Object); var result = tb.UpdateTask(newTask) as OkNegotiatedContentResult <string>; dbContext.Verify(x => x.SaveChanges()); Assert.AreEqual(result.Content, "Task Updated Successfully"); var confirmResult = tb.GetTask(5) as OkNegotiatedContentResult <Tasks>; Assert.AreEqual(confirmResult.Content.Task, newTask.Task); }
public void TestUpdate() { ProjectManagerController taskManagerController = new ProjectManagerController(); 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; taskManagerController.UpdateTask(task); task = taskManagerController.GetTask(task.TaskId); Assert.IsTrue(task.Name == newName); }
public void TestWebApiUpdateTask() { Task item = new Task(); item.TaskID = taskId; item.TaskName = "TaskApiTest1"; item.Priority = 15; item.ParentID = 1; item.StartDate = DateTime.Now; item.EndDate = DateTime.Now.AddDays(5); item.Status = true; IHttpActionResult actionResult = projectObj.UpdateTask(item); var contentResult = actionResult as NegotiatedContentResult <Task>; // Assert Assert.IsNotNull(contentResult); Assert.AreEqual(HttpStatusCode.Accepted, contentResult.StatusCode); Assert.IsNotNull(contentResult.Content); Assert.AreEqual(item.Priority, contentResult.Content.Priority); }