Exemplo n.º 1
0
    public void TestUpdateShouldReturnOk()
    {
        if (!did_create_test_run)
        {
            TestCreateShouldReturnNewId();
        }

        ProblemDAO dao = new ProblemDAO();
        Problem    p   = dao.GetById(id_string);

        p.Description = "Go now, there are other worlds then these";
        Assert.IsTrue(dao.Update(p) == UpdateStatus.Ok);

        p             = dao.GetById(id_string); // get a new copy with the proper version #
        p.Description = description;            // now revert back to original description
        Assert.IsTrue(dao.Update(p) == UpdateStatus.Ok);
    }// TestUpdateShouldReturOk
Exemplo n.º 2
0
    public void TestDeleteShouldReturnOne()
    {
        if (!did_create_test_run)
        {
            TestCreateShouldReturnNewId();
        }

        ProblemDAO dao = new ProblemDAO();
        Problem    p   = dao.GetById(id_string);

        Assert.IsTrue(dao.Delete(p.GetIdAsString()) == 1);
    } // TestShouldReturnOne
Exemplo n.º 3
0
    public void TestUpdateShouldReturnStale()
    {
        if (!did_create_test_run)
        {
            TestCreateShouldReturnNewId();
        }

        ProblemDAO dao = new ProblemDAO();
        Problem    p1  = dao.GetById(id_string);
        Problem    p2  = dao.GetById(id_string);

        p1.Description = "description 1";
        p1.Description = "description 1";
        UpdateStatus status = dao.Update(p1);

        Assert.IsTrue(dao.Update(p2) == UpdateStatus.Stale);

        p1             = dao.GetById(id_string); // get a new copy with the proper version #
        p1.Description = description;            // now revert back to original description
        Assert.IsTrue(dao.Update(p1) == UpdateStatus.Ok);
    }// TestUpdateShouldReturnStale
Exemplo n.º 4
0
 public void GetById()
 {
     try
     {
         Problem prob = _dao.GetById(ProblemId);
         Description = prob.Description;
         Version     = prob.Version;
         ProblemId   = prob.GetIdAsString();
     }
     catch (Exception ex)
     {
         ViewModelUtils.ErrorRoutine(ex, "ProblemViewModel", "GetById");
     }
 }
Exemplo n.º 5
0
    public void TestGetByIdShouldReturnProblem()
    {
        if (!did_create_test_run)
        {
            TestCreateShouldReturnNewId();
        }

        ProblemDAO dao = new ProblemDAO();
        Problem    p   = dao.GetById(id_string);

        Assert.IsInstanceOfType(p, typeof(Problem));
        Assert.AreEqual(p.Description, description);
        Assert.AreEqual(p.GetIdAsString(), id_string);
    }// TestGetByIdShouldReturnProblem