public void Initialize() { _departmentItem = new DepartmentSqlDAL(_connectionString); _department = new Department(); _department.Name = "Test Department"; _department.Id = _departmentItem.CreateDepartment(_department); // Initialize a new transaction scope. This automatically begins the transaction. tran = new TransactionScope(); _employeeItem = new EmployeeSqlDAL(_connectionString); _employee = new Employee(); _employee.DepartmentId = _department.Id; _employee.FirstName = "John"; _employee.LastName = "Smith"; _employee.Gender = "M"; _employee.JobTitle = "Developer"; _employee.BirthDate = new DateTime(1990, 01, 01); _employee.HireDate = new DateTime(2000, 02, 03); _employee.EmployeeId = _employeeItem.CreateEmployee(_employee); }
public void DepartmentTests() { // Open a SqlConnection object using the active transaction using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); DepartmentSqlDAL testDAL = new DepartmentSqlDAL(connectionString); IList <Department> testList = new List <Department>(); testList = testDAL.GetDepartments(); int savecount = testList.Count; Assert.AreNotEqual(0, testList.Count, "There should be Initial Data"); Department testDepartment = new Department(); testDepartment.Name = "alkjfagjhasivs"; departmentId = testDAL.CreateDepartment(testDepartment); Assert.AreNotEqual(0, departmentId, "Deparment ID should be greater than 0"); testDepartment = testDAL.GetADepartment(departmentId); Assert.AreEqual(departmentId, testDepartment.Id, "Department IDs should match"); Assert.AreEqual("alkjfagjhasivs", testDepartment.Name, "Departname should be \"alkjfagjhasivs\""); testList = testDAL.GetDepartments(); Assert.AreEqual(savecount + 1, testList.Count, "List should have 1 more element"); testDepartment.Name = "zzhzhzhzhzhzhz"; testDepartment.Id = departmentId; bool status = testDAL.UpdateDepartment(testDepartment); Assert.AreEqual(true, status); testDepartment = testDAL.GetADepartment(departmentId); Assert.AreEqual("zzhzhzhzhzhzhz", testDepartment.Name); } }
public void CreateDepartmentTest() { DepartmentSqlDAL departmentDAL = new DepartmentSqlDAL(connectionString); Department department = new Department(); department.Name = "Brand New Dept"; int otherID = departmentDAL.CreateDepartment(department); Assert.AreEqual(id + 1, otherID); }
public void CreateDepartmentTest() { Department testdept = new Department(); testdept.Id = departmentID + 1; testdept.Name = "steve"; Assert.IsTrue(test.CreateDepartment(testdept)); }
public void CreateDept() { DepartmentSqlDAL deptSqlDal = new DepartmentSqlDAL(connectionString); Department dept = new Department { Name = "Test Dept" }; bool didWork = deptSqlDal.CreateDepartment(dept); Assert.AreEqual(true, didWork); }
public void CreateDepartmentTest() { DepartmentSqlDAL testDept = new DepartmentSqlDAL(connectionString); Department newDept = new Department { Name = "MyTestDept" }; bool isCreated = testDept.CreateDepartment(newDept); Assert.IsTrue(isCreated); }
public void CreateDepartmentTests() { DepartmentSqlDAL deptDal = new DepartmentSqlDAL(connectionString); Department dept = new Department(); dept.Id = 6; dept.Name = "Logistics"; bool createWorked = deptDal.CreateDepartment(dept); Assert.AreEqual(true, createWorked); }
public void CreateDepartmentTest() { DepartmentSqlDAL departmentDAL = new DepartmentSqlDAL(connectionString); Department departmentTestObj = new Department(); departmentTestObj.Name = "AnyName"; bool createdDepartment = departmentDAL.CreateDepartment(departmentTestObj); Assert.AreEqual(true, createdDepartment); }
public void CreateDepartmentTest() { DepartmentSqlDAL departmentSqlDAL = new DepartmentSqlDAL(connectionString); Department department = new Department { Name = "A New Department" }; int didItWork = departmentSqlDAL.CreateDepartment(department); Assert.AreNotEqual(0, didItWork, "CreateDepartment failed, it returned 0."); }
public void UpdateDepartmentTest() { DepartmentSqlDAL departmentSqlDal = new DepartmentSqlDAL(connectionString); Department d = new Department(); d.Id = 1; d.Name = "noname"; bool result = departmentSqlDal.CreateDepartment(d); Assert.AreEqual(true, result); }
public void CreateDepartmentsTest() { DepartmentSqlDAL departmentDAL = new DepartmentSqlDAL(connectionString); Department department = new Department { Name = "Eric's Place", }; int ericID = departmentDAL.CreateDepartment(department); Assert.AreEqual(maxID + 1, department.Id); }
public void CreateDeptartmentTest() { DepartmentSqlDAL createDeptTest = new DepartmentSqlDAL(connectionString); Department testCreateDept = new Department(); testCreateDept.Name = "TestDeptCreate"; bool didWork = createDeptTest.CreateDepartment(testCreateDept); List <Department> deptList = createDeptTest.GetDepartments(); Assert.IsTrue(didWork); Assert.AreEqual(deptCount + 2, deptList.Count); }
public void CreateDepartmentTest() { DepartmentSqlDAL departments = new DepartmentSqlDAL(connectionString); Department ABC = new Department() { Name = "ABC" }; bool isTrue = departments.CreateDepartment(ABC); Assert.AreEqual(true, isTrue); }
public void CreateDepartmentTest() { DepartmentSqlDAL departmentSqlDal = new DepartmentSqlDAL(connectionString); Department d = new Department(); d.Name = "heyo"; bool result = false; result = departmentSqlDal.CreateDepartment(d); Assert.AreEqual(true, result); }
public void Initialize() { // Initialize a new transaction scope. This automatically begins the transaction. tran = new TransactionScope(); _departmentItem = new DepartmentSqlDAL(_connectionString); _department = new Department(); _department.Name = "A Department"; _department.Id = _departmentItem.CreateDepartment(_department); }
public void TestCreateDepartment() { //Arrange DepartmentSqlDAL departmentDAL = new DepartmentSqlDAL(connectionString); Department updatedDepartment = new Department(); updatedDepartment.Name = "UpdatedDepartmentName"; //Act bool successChange = departmentDAL.CreateDepartment(updatedDepartment); List <Department> departments = departmentDAL.GetDepartments(); //Assert Assert.AreEqual(departmentCount + 1, departments.Count); }
public void CreateDepartmentTest() { DepartmentSqlDAL departmentDAL = new DepartmentSqlDAL(connectionString); //Act Department newDepartment = new Department() { Name = "Xbox" }; bool wasSuccessful = departmentDAL.CreateDepartment(newDepartment); //Assert Assert.AreEqual(true, wasSuccessful); }
public void CreateDepartmentTest() { //Arrange int originalCount = GetCountOfDepartments(); Department newDept = new Department { Name = "New Test Department" }; DepartmentSqlDAL dal = new DepartmentSqlDAL(ConnectionString); //Act bool result = dal.CreateDepartment(newDept); //Assert Assert.IsTrue(result); Assert.AreEqual(originalCount + 1, GetCountOfDepartments()); }
public void DepartmentFailTest() { DepartmentSqlDAL deptTest02 = new DepartmentSqlDAL(connectionString); Department badDept02 = new Department(); badDept02.Name = "12345678912345678912345678912345678912345"; try { deptTest02.CreateDepartment(badDept02); } catch (SqlException) { throw; } }
private void CreateDepartment() { string departmentName = CLIHelper.GetString("Provide a name for the new department:"); Department newDept = new Department { Name = departmentName }; DepartmentSqlDAL dal = new DepartmentSqlDAL(DatabaseConnection); bool result = dal.CreateDepartment(newDept); if (result) { Console.WriteLine("*** SUCCESS ***"); } else { Console.WriteLine("*** DID NOT CREATE ***"); } }