public void ProblemDAOUpdateTwiceShouldReturnNegative() { ProblemDAO dao = new ProblemDAO(); //simulate 2 users getting an Problem Problem prob = dao.GetByID("563d30b53dd4dd34b4c05cc2"); Problem prob2 = dao.GetByID("563d30b53dd4dd34b4c05cc2"); prob.Description = "Device Not Turned On"; int rowsUpdated = dao.Update(prob); if (rowsUpdated == 1) { rowsUpdated = dao.Update(prob2); } Assert.IsTrue(rowsUpdated == -2); }
public void ProblemDAOUpdateShouldReturnTrue() { ProblemDAO dao = new ProblemDAO(); //simulate user 1 getting an Problem Problem prob = dao.GetByID("563d30b53dd4dd34b4c05cc2"); prob.Description = "Device Not Turned On"; int rowsUpdated = dao.Update(prob); //user 1 makes update Assert.IsTrue(rowsUpdated == 1); }
// //find Problem with surnme from dal // public void GetByID(string id) { try { Problem prob = _dao.GetByID(id); Id = prob._id.ToString(); Description = prob.Description; Entity64 = Convert.ToBase64String(Serializer(prob)); } catch (Exception ex) { ErrorRoutine(ex, "ProblemViewModel", "GetByID"); } }