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); } }