示例#1
0
    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
示例#2
0
    public DepartmentDAOTests()
    {
        DepartmentDAO dao = new DepartmentDAO();
        Department    dep = dao.GetByDepartment("Sales");

        id_string = dep.GetIdAsString();
    }// no-arg constructor
示例#3
0
    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");
     }
 }