public void TestDeleteProject_NoProjectAsParameter() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <ProjectManager.DAC.User>(); users.Add(new ProjectManager.DAC.User() { Employee_ID = "414671", First_Name = "disha", Last_Name = "shaw", User_ID = 123, Task_ID = 123 }); context.Users = users; ProjectManager.Models.Project testProject = null; var controller = new ProjectController(new ProjectManager.BC.ProjectBC(context)); var result = controller.DeleteProjectDetails(testProject) as JSonResponse; }
public void TestRetrieveTasks_Success() { var context = new MockProjectManagerEntities(); var tasks = new TestDbSet <ProjectManager.DAC.Task>(); var users = new TestDbSet <ProjectManager.DAC.User>(); var parentTasks = new TestDbSet <ProjectManager.DAC.ParentTask>(); parentTasks.Add(new ProjectManager.DAC.ParentTask() { Parent_ID = 123456, Parent_Task_Name = "PNB" }); context.ParentTasks = parentTasks; users.Add(new ProjectManager.DAC.User() { Employee_ID = "414671", First_Name = "disha", Last_Name = "shaw", User_ID = 123, Task_ID = 1 }); context.Users = users; int projectid = 1234; tasks.Add(new ProjectManager.DAC.Task() { Task_ID = 1, Task_Name = "ASDQW", Parent_ID = 123456, Project_ID = 1234, Start_Date = DateTime.Now, End_Date = DateTime.Now.AddDays(2), Priority = 10, Status = 0 }); context.Tasks = tasks; var controller = new TaskController(new ProjectManager.BC.TaskBC(context)); var result = controller.RetrieveTaskByProjectId(projectid) as JSonResponse; Assert.IsNotNull(result); Assert.IsInstanceOfType(result.Data, typeof(List <ProjectManager.Models.Task>)); }
public void TestInsertTasks_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <ProjectManager.DAC.User>(); users.Add(new ProjectManager.DAC.User() { Employee_ID = "414671", First_Name = "disha", Last_Name = "shaw", User_ID = 123, Task_ID = 123 }); context.Users = users; var task = new ProjectManager.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 = "disha", LastName = "shaw", EmployeeId = "123456", UserId = 123 } }; var controller = new TaskController(new ProjectManager.BC.TaskBC(context)); var result = controller.InsertTaskDetails(task) as JSonResponse; Assert.IsNotNull(result); Assert.IsNotNull((context.Users.Local[0]).Task_ID); }
public void TestDeleteUser_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <ProjectManager.DAC.User>(); users.Add(new ProjectManager.DAC.User() { Employee_ID = "592561", First_Name = "narayan", Last_Name = "dubey", Project_ID = 123, Task_ID = 123, User_ID = 592561 }); users.Add(new ProjectManager.DAC.User() { Employee_ID = "493210", First_Name = "Prasun", Last_Name = "sarkar", Project_ID = 1234, Task_ID = 1234, User_ID = 493210 }); context.Users = users; var user = new ProjectManager.Models.User(); user.FirstName = "Prasun"; user.LastName = "sarkar"; user.EmployeeId = "493210"; user.UserId = 493210; var controller = new UserController(new ProjectManager.BC.UserBC(context)); var result = controller.DeleteUserDetails(user) as JSonResponse; Assert.IsNotNull(result); Assert.AreEqual(context.Users.Local.Count, 1); }
public void TestInsertProjects_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <ProjectManager.DAC.User>(); users.Add(new ProjectManager.DAC.User() { Employee_ID = "414671", First_Name = "disha", Last_Name = "shaw", User_ID = 123, Task_ID = 123 }); context.Users = users; var testProject = new ProjectManager.Models.Project() { ProjectId = 12345, ProjectName = "MyProject", ProjectStartDate = DateTime.Now, ProjectEndDate = DateTime.Now.AddDays(5), Priority = 3, NoOfCompletedTasks = 3, NoOfTasks = 5, User = new User() { FirstName = "disha", LastName = "shaw", EmployeeId = "123456", UserId = 123 } }; var controller = new ProjectController(new ProjectManager.BC.ProjectBC(context)); var result = controller.InsertProjectDetails(testProject) as JSonResponse; Assert.IsNotNull(result); Assert.IsNotNull((context.Users.Local[0]).Project_ID); }
public void TestRetrieveParentTasks_Success() { var context = new MockProjectManagerEntities(); var parentTasks = new TestDbSet <ProjectManager.DAC.ParentTask>(); parentTasks.Add(new ProjectManager.DAC.ParentTask() { Parent_ID = 12345, Parent_Task_Name = "ANB" }); parentTasks.Add(new ProjectManager.DAC.ParentTask() { Parent_ID = 123456, Parent_Task_Name = "PNB" }); context.ParentTasks = parentTasks; var controller = new TaskController(new ProjectManager.BC.TaskBC(context)); var result = controller.RetrieveParentTasks() as JSonResponse; Assert.IsNotNull(result); Assert.IsInstanceOfType(result.Data, typeof(List <ProjectManager.Models.ParentTask>)); Assert.AreEqual((result.Data as List <ParentTask>).Count, 2); }