public void TestInsertProject_CompletedTasksGreater() { var context = new Test_Project_ManagerContext(); var users = new TestDbSet <DAC.User>(); users.Add(new DAC.User() { Employee_ID = "375543", First_Name = "Robert", Last_Name = "Morin", User_ID = 123, Task_ID = 123 }); context.Users = users; Models.Project testProject = new Models.Project() { ProjectId = 234, NoOfCompletedTasks = 10, NoOfTasks = 5, Priority = 1, ProjectEndDate = DateTime.Now.AddDays(10), ProjectStartDate = DateTime.Now, ProjectName = "TEST", User = new User() { EmployeeId = 123.ToString(), FirstName = "Riddhi", LastName = "Roy Choudhury", ProjectId = 234, UserId = 123 } }; var controller = new ProjectController(new BC.ProjectBC(context)); var result = controller.AddProjectDetails(testProject) as JSendResponse; }
public void TestInsertProject_NoProjectAsParameter() { var context = new Test_Project_ManagerContext(); var users = new TestDbSet <DAC.User>(); users.Add(new DAC.User() { Employee_ID = "375543", First_Name = "Robert", Last_Name = "Morin", User_ID = 123, Task_ID = 123 }); context.Users = users; Models.Project testProject = null; var controller = new ProjectController(new BC.ProjectBC(context)); var result = controller.AddProjectDetails(testProject) as JSendResponse; }
public void TestInsertProjects_Success() { var context = new Test_Project_ManagerContext(); var users = new TestDbSet <DAC.User>(); users.Add(new DAC.User() { Employee_ID = "375543", First_Name = "Robert", Last_Name = "Morin", 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 = "Riddhi", LastName = "Roy", EmployeeId = "353587", UserId = 001 } }; var controller = new ProjectController(new BC.ProjectBC(context)); var result = controller.AddProjectDetails(testProject) as JSendResponse; Assert.IsNotNull(result); Assert.IsNotNull((context.Users.Local[0]).Project_ID); }