public void TestUpdateShouldReturnStale() { ProblemDAO dao = new ProblemDAO(); Problem prob = dao.GetByProblemDescription("Memory Failure"); Problem prob2 = dao.GetByProblemDescription("Memory Failure"); prob.Description = "Butcher"; prob2.Description = "LOL"; UpdateStatus status = dao.Update(prob); Assert.IsTrue(dao.Update(prob2) == UpdateStatus.Stale); }
public void TestDeleteShouldReturnOne() { ProblemDAO dao = new ProblemDAO(); Problem prob = dao.GetByProblemDescription("Testing"); if (prob == null) { TestCreateShouldReturnNewId(); prob = dao.GetByProblemDescription("Testing"); } Assert.IsTrue(dao.Delete(prob.GetIdAsString()) == 1); }
public void TestUpdateShouldReturnOk() { ProblemDAO dao = new ProblemDAO(); Problem prob = dao.GetByProblemDescription("Hard Drive Failure"); prob.Description = "No Ram"; Assert.IsTrue(dao.Update(prob) == UpdateStatus.Ok); }
public ProblemDAOTests() { DALUtils util = new DALUtils(); util.LoadCollections(); ProblemDAO dao = new ProblemDAO(); Problem prob = dao.GetByProblemDescription("Device Not Plugged In"); pid = prob.GetIdAsString(); }
/* * GetByProblemDescription() * Gets the specific problem based on the "Description" of the Problem */ public void GetByProblemDescription() { try { Problem prob = _dao.GetByProblemDescription(Description); Id = prob.GetIdAsString(); Description = prob.Description; Version = prob.Version; } catch (Exception ex) { ViewModelUtils.ErrorRoutine(ex, "ProblemViewModel", "GetByProblemDescription"); } }
public void ComprehensiveDAOTestsShouldReturnTrue() { CallDAO cdao = new CallDAO(); EmployeeDAO edao = new EmployeeDAO(); ProblemDAO pdao = new ProblemDAO(); Call call = new Call(); call.DateOpened = System.DateTime.Now; call.DateClosed = null; call.OpenStatus = true; call.SetEmployeeIdFromString(edao.GetByLastname("Smartypants").GetIdAsString()); call.SetTechIdFromString(edao.GetByLastname("Burner").GetIdAsString()); call.SetProblemIdFromString(pdao.GetByProblemDescription("Memory Upgrade").GetIdAsString()); call.Notes = "Bigshot has bad RAM, burner to fix it"; call.Version = 1; call = cdao.Create(call); this.tstCtx.WriteLine("New Call Generated - Id = " + call.GetIdAsString()); call = cdao.GetById(call.GetIdAsString()); this.tstCtx.WriteLine("New Call Retrieved"); call.Notes = "\n Ordered new RAM!"; if (cdao.Update(call) == UpdateStatus.Ok) { this.tstCtx.WriteLine("Call was updated " + call.Notes); } else { this.tstCtx.WriteLine("Call was not updated!"); } if (cdao.Update(call) == UpdateStatus.Stale) { this.tstCtx.WriteLine("Call not updated due to stale data"); } if (cdao.Delete(call.GetIdAsString()) == 1) { this.tstCtx.WriteLine("Call was deleted!"); } else { this.tstCtx.WriteLine("Call was not deleted"); } Assert.IsNull(cdao.GetById(call.GetIdAsString())); }
public void TestGetByProblemDescriptionShouldReturnProblem() { ProblemDAO dao = new ProblemDAO(); Assert.IsInstanceOfType(dao.GetByProblemDescription("Device Not Turned On"), typeof(Problem)); }