public void TestDeleteProject_NoProjectAsParameter() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <DAC.User>(); users.Add(new DAC.User() { Employee_ID = "136600", First_Name = "Sachin", Last_Name = "Kumar", User_ID = 123, Task_ID = 123 }); context.Users = users; Models.Project testProject = null; var controller = new ProjectController(new BusLayer.ProjectBL(context)); var result = controller.DeleteProjectDetails(testProject) as JsonResponse; }
public void TestRetrieveTasks_Success() { var context = new MockProjectManagerEntities(); var tasks = new TestDbSet <DAC.Task>(); var users = new TestDbSet <DAC.User>(); var parentTasks = new TestDbSet <DAC.ParentTask>(); parentTasks.Add(new DAC.ParentTask() { Parent_ID = 789, Parent_Task_Name = "PNB" }); context.ParentTasks = parentTasks; users.Add(new DAC.User() { Employee_ID = "136600", First_Name = "Sachin", Last_Name = "Kumar", User_ID = 123, Task_ID = 1 }); context.Users = users; int projectid = 4567; tasks.Add(new DAC.Task() { Task_ID = 1, Task_Name = "ASDQW", Parent_ID = 789, Project_ID = 4567, Start_Date = DateTime.Now, End_Date = DateTime.Now.AddDays(2), Priority = 10, Status = 0 }); context.Tasks = tasks; var controller = new TaskController(new BusLayer.TaskBL(context)); var result = controller.RetrieveTaskByProjectId(projectid) as JsonResponse; Assert.IsNotNull(result); Assert.IsInstanceOfType(result.Data, typeof(List <ProjectManagerAPI.Models.Task>)); }
public void TestInsertTasks_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <DAC.User>(); users.Add(new DAC.User() { Employee_ID = "136600", First_Name = "Sachin", Last_Name = "Kumar", User_ID = 123, Task_ID = 123 }); context.Users = users; var task = new ProjectManagerAPI.Models.Task() { Task_Name = "ASDQW", Parent_ID = 123674, Project_ID = 34856, Start_Date = DateTime.Now, End_Date = DateTime.Now.AddDays(2), Priority = 10, Status = 0, User = new User() { FirstName = "Sachin", LastName = "Kumar", EmployeeId = "789", UserId = 123 } }; var controller = new TaskController(new BusLayer.TaskBL(context)); var result = controller.InsertTaskDetails(task) as JsonResponse; Assert.IsNotNull(result); Assert.IsNotNull((context.Users.Local[0]).Task_ID); }
public void TestInsertProjects_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <DAC.User>(); users.Add(new DAC.User() { Employee_ID = "136600", First_Name = "Sachin", Last_Name = "Kumar", User_ID = 123, Task_ID = 123 }); context.Users = users; var testProject = new Models.Project() { ProjectId = 45675, ProjectName = "MyProject", ProjectStartDate = DateTime.Now, ProjectEndDate = DateTime.Now.AddDays(5), Priority = 3, NoOfCompletedTasks = 3, NoOfTasks = 5, User = new User() { FirstName = "Sachin", LastName = "Kumar", EmployeeId = "789", UserId = 123 } }; var controller = new ProjectController(new BusLayer.ProjectBL(context)); var result = controller.InsertProjectDetails(testProject) as JsonResponse; Assert.IsNotNull(result); Assert.IsNotNull((context.Users.Local[0]).Project_ID); }