Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 //
 //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");
     }
 }