//Method used to get all task items list public IHttpActionResult GetAllTasks() { blObject = new TaskManagerBL(); List <Task> tasks = blObject.GetAllTasks(); return(Ok(tasks)); }
public void Test_GetAllTasks() { IEnumerable <TaskManager.DataLayer.Task> lstTask = new List <TaskManager.DataLayer.Task> { new TaskManager.DataLayer.Task() { Task1 = "Task1", Start_Date = new DateTime(2018, 08, 14), End_Date = new DateTime(2018, 08, 20), Priority = 10, ParentTask = new ParentTask() { Parent_Task = "ParentTask1" } }, new TaskManager.DataLayer.Task() { Task1 = "Task2", Start_Date = new DateTime(2018, 08, 16), End_Date = new DateTime(2018, 08, 22), Priority = 15, ParentTask = new ParentTask() { Parent_Task = "ParentTask2" } }, new TaskManager.DataLayer.Task() { Task1 = "Task3", Start_Date = new DateTime(2018, 08, 18), End_Date = new DateTime(2018, 08, 24), Priority = 20, ParentTask = new ParentTask() { Parent_Task = "ParentTask3" } }, new TaskManager.DataLayer.Task() { Task1 = "Task4", Start_Date = new DateTime(2018, 08, 20), End_Date = new DateTime(2018, 08, 26), Priority = 25, ParentTask = new ParentTask() { Parent_Task = "ParentTask4" } }, new TaskManager.DataLayer.Task() { Task1 = "Task5", Start_Date = new DateTime(2018, 08, 22), End_Date = new DateTime(2018, 08, 28), Priority = 30, ParentTask = new ParentTask() { Parent_Task = "ParentTask5" } }, }; Mock <ITaskDbService> mockDb = new Mock <ITaskDbService>(); TaskManagerBL obj = new TaskManagerBL(mockDb.Object); mockDb.Setup(c => c.GetAllTasks()).Returns(lstTask.AsQueryable()); var expectedCount = 5; var result = obj.GetAllTasks(); Assert.AreEqual(expectedCount, result.Count()); }
public void GetAllTasksTest() { int result = blObj.GetAllTasks().Count; Assert.IsTrue(result > 0); }
//Performance checking for All List items been retrieved public void GetAllTasksTest() { blObj.GetAllTasks(); }