public void TestDeleteShouldReturnOne() { DepartmentDAO dao = new DepartmentDAO(); Department dep = dao.GetByDepartment("Test Department"); if (dep == null) // in case this test runs before the Create method test { TestCreateShouldReturnNewId(); // run it for sure dep = dao.GetByDepartment("Test Department"); } Assert.IsTrue(dao.Delete(dep.GetIdAsString()) == 1); } // TestShouldReturnOne
public DepartmentDAOTests() { DepartmentDAO dao = new DepartmentDAO(); Department dep = dao.GetByDepartment("Sales"); id_string = dep.GetIdAsString(); }// no-arg constructor
public void TestGetByDepartmentNameShouldReturnDepartment() { DepartmentDAO dao = new DepartmentDAO(); Department dep = dao.GetByDepartment("Sales"); Assert.IsInstanceOfType(dep, typeof(Department)); Assert.AreEqual(dep.DepartmentName, "Sales"); Assert.AreEqual(dep.GetIdAsString(), id_string); }// TestGetByDepartmentNameShouldReturnDepartment
public void GetByDepartment() { try { Department dept = _dao.GetByDepartment(DepartmentName); Id = dept.GetIdAsString(); dept.Version = Version; } catch (Exception ex) { ViewModelUtils.ErrorRoutine(ex, "DepartmentViewModel", "GetByDepartment"); } }