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