public void When_GetAllTasks_Then_ShouldReturnAllTasks() { var result = controller.GetAllTasks() as OkNegotiatedContentResult <List <TaskEntity> >; Assert.IsNotNull(result); //Assert.AreEqual(result.Content.Count, 2); }
public void GetAllTaskTest() { ProjectManagerController tb = new ProjectManagerController(dbContext.Object); var result = tb.GetAllTasks(2) as OkNegotiatedContentResult <List <DetailedTasks> >; Assert.AreEqual(result.Content.Count, 2); Assert.AreEqual(result.Content[0].Task, "ParentTask2"); }
public void TestAdd() { ProjectManagerController taskManagerController = new ProjectManagerController(); int projectid = taskManagerController.GetAllProjects().FirstOrDefault().ProjectId; taskManagerController.AddTask(new Models.Task() { Name = "AddTask", ProjectId = projectid, 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()); }
public void TestDelete() { ProjectManagerController taskManagerController = new ProjectManagerController(); taskManagerController.AddTask(new Models.Task() { Name = "TestDelete1", 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.Where(t => t.Name == "TestDelete1").FirstOrDefault().TaskId; Task task = taskManagerController.GetTask(taskId); taskManagerController.DeleteTask(taskId); task = taskManagerController.GetTask(taskId); Assert.IsNull(task); }
public void GetAllTaskTest_IterationsMode() { var result = tb.GetAllTasks(2) as OkNegotiatedContentResult <List <DetailedTasks> >; }