public void GetAllProjectsTest() { ProjectSqlDAO projectSqlDAO = new ProjectSqlDAO(connectionString); List <Project> projectsTest = (List <Project>)projectSqlDAO.GetAllProjects(); Assert.AreEqual(7, projectsTest.Count); }
public void GetAllProjects_Should_Return_The_Correct_Count() { ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); IList <Project> projects = dao.GetAllProjects(); Assert.AreEqual(1, projects.Count); }
public void GetAllProjectsTest() { //Act IList <Project> projects = dao.GetAllProjects(); Assert.IsNotNull(projects); Assert.AreEqual(6, projects.Count); }
public void GetProjectsShouldReturnRightNumberofProjects() { // Arrange ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); //ACT IList <Project> project = dao.GetAllProjects(); //ASERT Assert.AreEqual(GetRowCount("project"), project.Count); }
public void GetAllProjectsTest() { ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); IList <Project> iprojects = dao.GetAllProjects(); List <Project> projects = iprojects.ToList(); Assert.IsNotNull(projects); Assert.IsTrue(projects.Count > 0); Assert.IsNotNull(projects.Find(p => p.ProjectId == testProjectId)); }
public void Get_all_projects_Test() { //Arrange ProjectSqlDAO allProjects = new ProjectSqlDAO(ConnectionString); List <Project> projectList = (List <Project>)allProjects.GetAllProjects(); //Assert Assert.IsNotNull(projectList); Assert.AreEqual(project_id + 1, projectList.Count); }
public void GetAllProjects_ShouldReturnRightNumberOfProjects() { //Arrange const int numberOfProjectsAddedForTests = 1;//set in sql test setup file ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); //Act IList <Project> projects = dao.GetAllProjects(); //Assert Assert.AreEqual(numberOfProjectsAddedForTests, projects.Count, "GetAllProjects doesn't return correct number for one project"); }
public void GetAllProjectsTest() { // Arrange ProjectSqlDAO project = new ProjectSqlDAO(ConnectionString); // Act IList <Project> projects = project.GetAllProjects(); // Assert Assert.AreEqual(1, projects.Count); }
public void GetAllProjectsTest() { ProjectSqlDAO access = new ProjectSqlDAO(connectionString); IList <Project> items = access.GetAllProjects(); bool found = false; foreach (Project item in items) { if (item.Name == "ZZZZZ") { found = true; break; } } Assert.IsTrue(found); }
public void GetAllProjects() { ProjectSqlDAO project = new ProjectSqlDAO(connectionString); IList <Project> projectList = project.GetAllProjects(); bool found = false; foreach (Project item in projectList) { if (item.Name == "ProjectDoesNotMatter") { found = true; break; } } Assert.IsTrue(found); }
public void CreateProject_ShouldReturnRightNumberOfProjects() { //Arrange const int numberOfProjectsAfterCreated = 2;//set in sql test setup file plus the one we are creating here ProjectSqlDAO dao = new ProjectSqlDAO(ConnectionString); Project newProject = new Project(); newProject.Name = "create test"; newProject.StartDate = Convert.ToDateTime("2020-02-19"); newProject.EndDate = Convert.ToDateTime("2020-02-19"); //Act dao.CreateProject(newProject); //Assert Assert.AreEqual(numberOfProjectsAfterCreated, dao.GetAllProjects().Count); }
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"); }
public void RemoveEmployeeFromProject_ShouldReturnTrueWhenEmployeeRemoved() { //Arrange const bool expectedResult = true;//when employee successfully removed, function should return true ProjectSqlDAO projectDao = new ProjectSqlDAO(ConnectionString); EmployeeSqlDAO empDao = new EmployeeSqlDAO(ConnectionString); IList <Project> projects = projectDao.GetAllProjects(); IList <Employee> testEmployee = empDao.Search("John", "Smith");//Get the employee added in sql test file that does have a project assigned. name from sql test file //Act bool resultOfRemove = projectDao.RemoveEmployeeFromProject(projects[0].ProjectId, testEmployee[0].EmployeeId);//remove employee with project from the only project //Assert Assert.AreEqual(expectedResult, resultOfRemove, "RemoveEmployeeFromProject doesn't return true when employee removed"); }
public void RemoveEmployeeFromProject_ShouldReturnRightNumberOfEmployees() { //Arrange const int numberOfEmployeesWithoutProjects = 2;//set in sql test setup file plus the one employee removed here ProjectSqlDAO projectDao = new ProjectSqlDAO(ConnectionString); EmployeeSqlDAO empDao = new EmployeeSqlDAO(ConnectionString); IList <Project> projects = projectDao.GetAllProjects(); IList <Employee> testEmployee = empDao.Search("John", "Smith");//Get the employee added in sql test file that does have a project assigned. name from sql test file //Act projectDao.RemoveEmployeeFromProject(projects[0].ProjectId, testEmployee[0].EmployeeId);//remove employee with project from the only project //Assert Assert.AreEqual(numberOfEmployeesWithoutProjects, empDao.GetEmployeesWithoutProjects().Count, "Remove Employee doesn't return correct number when employee removed"); }