public void AssignEmployeeToProjectTest() { ProjectSqlDAO projectSqlDAO = new ProjectSqlDAO(connectionString); bool result = projectSqlDAO.AssignEmployeeToProject(2, 1); Assert.AreEqual(true, result); }
public void AssignEmployeeToProjectTest() { ProjectSqlDAO access = new ProjectSqlDAO(connectionString); //Do we need to add a project and an employee for this, or is this ok? bool result = access.AssignEmployeeToProject(6, 1); Assert.IsTrue(result); using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); string sql_select = "SELECT * FROM project_employee WHERE project_id = 6 AND employee_id = 1;"; SqlCommand cmd = new SqlCommand(sql_select, conn); SqlDataReader reader = cmd.ExecuteReader(); int count = 0; while (reader.Read()) { count++; } Assert.AreEqual(1, count); } }
public void TestAssignEmployeeToProject() { ProjectSqlDAO project = new ProjectSqlDAO(connectionString); //Project deathStarProject = new Project("DeathStarQualityControl", DateTime.Now, DateTime.Now); //project.CreateProject(deathStarProject); //bool result = project.AssignEmployeeToProject(8, 14); bool result2 = project.AssignEmployeeToProject(newProjectId, 4); using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); string sql_select = "SELECT * FROM project_employee WHERE employee_id = 4 AND project_id = @newProjectId;"; SqlCommand cmd = new SqlCommand(sql_select, conn); cmd.Parameters.AddWithValue("@newProjectId", newProjectId); SqlDataReader reader = cmd.ExecuteReader(); int count = 0; while (reader.Read()) { count++; } Assert.AreEqual(1, count); } }
public void AssignEmployeeToExistingProject() { ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); bool result = dao.AssignEmployeeToProject(testProjectId, testEmpId2); Assert.IsTrue(result); }
public void AssignEmployeeToProject_Should_Add_Row() { ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); int initialRowCount = GetRowCount("project_employee"); bool added = dao.AssignEmployeeToProject(ProjectId, UnassignedEmployeeId); Assert.IsTrue(added); Assert.AreEqual(initialRowCount + 1, GetRowCount("project_employee")); }
public void Assigned_employee_to_project_by_id_Test() { int project_ids = 1; int employee_ids = 1; ProjectSqlDAO assignEm = new ProjectSqlDAO(ConnectionString); bool result = assignEm.AssignEmployeeToProject(project_ids, employee_ids); Assert.IsTrue(result); }
public void AssignEmployeeToAProjectTest() { // Arrange ProjectSqlDAO project = new ProjectSqlDAO(ConnectionString); // Act bool isAdded = project.AssignEmployeeToProject(NewProjId, NewEmployeeId); // Assert Assert.AreEqual(true, isAdded); }
public void AssignEmployeeToProjectShouldAssignEmployeeToProject() { ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); int startingRowCount = GetRowCount("project_employee"); dao.AssignEmployeeToProject(NewProjectId, NewEmployeeId2); int endingRowCount = GetRowCount("project_employee"); Assert.AreEqual(startingRowCount + 1, endingRowCount); }
public void AssignEmployeeToProjectTest() { int projectId; int employeeId; using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand("SELECT employee_id FROM employee WHERE first_name = 'Delora' and Last_name = 'Coty'", conn); employeeId = Convert.ToInt32(cmd.ExecuteScalar()); cmd = new SqlCommand("SELECT project_id FROM project WHERE name = 'Plan 9'", conn); projectId = Convert.ToInt32(cmd.ExecuteScalar()); } bool actualResult = dao.AssignEmployeeToProject(projectId, employeeId); //Assert Assert.AreEqual(true, actualResult); }
public void AssignEmployeeToProject_ShouldReturnRightNumberOfEmployees() { //Arrange const int numberOfEmployeesWithoutProjects = 0;//set in sql test setup file minus the one employee assigned here ProjectSqlDAO projectDao = new ProjectSqlDAO(ConnectionString); EmployeeSqlDAO empDao = new EmployeeSqlDAO(ConnectionString); IList <Project> projects = projectDao.GetAllProjects(); IList <Employee> testEmployee = empDao.GetEmployeesWithoutProjects();//Get the employee added in sql test file that does not have a project assigned //Act projectDao.AssignEmployeeToProject(projects[0].ProjectId, testEmployee[0].EmployeeId);//assign employee withou project to the only project //Assert Assert.AreEqual(numberOfEmployeesWithoutProjects, empDao.GetEmployeesWithoutProjects().Count, "GetAllProjects doesn't return correct number for one project"); }