public void TestDeleteProject_NoProjectAsParameter() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <DataAccessClasses.User>(); users.Add(new DataAccessClasses.User() { Employee_ID = "414942", First_Name = "indrayan", Last_Name = "ganguly", User_ID = 123, Task_ID = 123 }); context.Users = users; Models.Project testProject = null; var controller = new ProjectController(new ProjectBC(context)); var result = controller.DeleteProjectDetails(testProject) as JSendResponse; }
public void TestRetrieveTasks_Success() { var context = new MockProjectManagerEntities(); var tasks = new TestDbSet <DataAccessClasses.Task>(); var users = new TestDbSet <DataAccessClasses.User>(); var parentTasks = new TestDbSet <DataAccessClasses.ParentTask>(); parentTasks.Add(new DataAccessClasses.ParentTask() { Parent_ID = 123456, Parent_Task_Name = "PNB" }); context.ParentTasks = parentTasks; users.Add(new DataAccessClasses.User() { Employee_ID = "414942", First_Name = "indrayan", Last_Name = "ganguly", User_ID = 123, Task_ID = 1 }); context.Users = users; int projectid = 1234; tasks.Add(new DataAccessClasses.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 TaskBC(context)); var result = controller.RetrieveTaskByProjectId(projectid) as JSendResponse; Assert.IsNotNull(result); Assert.IsInstanceOfType(result.Data, typeof(List <Models.Task>)); }
public void TestInsertTasks_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <DataAccessClasses.User>(); users.Add(new DataAccessClasses.User() { Employee_ID = "414942", First_Name = "indrayan", Last_Name = "ganguly", User_ID = 123, Task_ID = 123 }); context.Users = users; var task = new 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 = "indrayan", LastName = "ganguly", EmployeeId = "123456", UserId = 123 } }; var controller = new TaskController(new TaskBC(context)); var result = controller.InsertTaskDetails(task) as JSendResponse; Assert.IsNotNull(result); Assert.IsNotNull((context.Users.Local[0]).Task_ID); }
public void TestDeleteUser_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <DataAccessClasses.User>(); users.Add(new DataAccessClasses.User() { Employee_ID = "418220", First_Name = "Suvam", Last_Name = "Chowdhury", Project_ID = 123, Task_ID = 123, User_ID = 418220 }); users.Add(new DataAccessClasses.User() { Employee_ID = "503322", First_Name = "Sriparna", Last_Name = "Sengupta", Project_ID = 1234, Task_ID = 1234, User_ID = 503322 }); context.Users = users; var user = new Models.User(); user.FirstName = "Sriparna"; user.LastName = "Sengupta"; user.EmployeeId = "503322"; user.UserId = 503322; var controller = new UserController(new UserBC(context)); var result = controller.DeleteUserDetails(user) as JSendResponse; Assert.IsNotNull(result); Assert.AreEqual(context.Users.Local.Count, 1); }
public void TestInsertProjects_Success() { var context = new MockProjectManagerEntities(); var users = new TestDbSet <DataAccessClasses.User>(); users.Add(new DataAccessClasses.User() { Employee_ID = "414942", First_Name = "indrayan", Last_Name = "ganguly", User_ID = 123, Task_ID = 123 }); context.Users = users; var testProject = new Models.Project() { ProjectId = 12345, ProjectName = "MyProject", ProjectStartDate = DateTime.Now, ProjectEndDate = DateTime.Now.AddDays(5), Priority = 3, NoOfCompletedTasks = 3, NoOfTasks = 5, User = new User() { FirstName = "indrayan", LastName = "ganguly", EmployeeId = "123456", UserId = 123 } }; var controller = new ProjectController(new ProjectBC(context)); var result = controller.InsertProjectDetails(testProject) as JSendResponse; Assert.IsNotNull(result); Assert.IsNotNull((context.Users.Local[0]).Project_ID); }
public void TestRetrieveParentTasks_Success() { var context = new MockProjectManagerEntities(); var parentTasks = new TestDbSet <DataAccessClasses.ParentTask>(); parentTasks.Add(new DataAccessClasses.ParentTask() { Parent_ID = 12345, Parent_Task_Name = "ANB" }); parentTasks.Add(new DataAccessClasses.ParentTask() { Parent_ID = 123456, Parent_Task_Name = "PNB" }); context.ParentTasks = parentTasks; var controller = new TaskController(new TaskBC(context)); var result = controller.RetrieveParentTasks() as JSendResponse; Assert.IsNotNull(result); Assert.IsInstanceOfType(result.Data, typeof(List <Models.ParentTask>)); Assert.AreEqual((result.Data as List <ParentTask>).Count, 2); }