Пример #1
0
        public void Call_ComprehensiveTest()
        {
            CallModel     cmodel = new CallModel();
            EmployeeModel emodel = new EmployeeModel();
            ProblemModel  pmodel = new ProblemModel();
            Calls         call   = new Calls();

            call.DateOpened = DateTime.Now;
            //call.DateClosed = null;
            call.OpenStatus = true;
            call.EmployeeId = emodel.GetByLastname("Park").Id;
            call.TechId     = emodel.GetByLastname("Burner").Id;
            call.ProblemId  = pmodel.GetByDescription("Hard Drive Failure").Id;
            call.Notes      = "Jimin's drive is shot, Burner to fix it";

            int newCallId = cmodel.Add(call);

            output.WriteLine("New Call Generated - Id = " + newCallId);
            call = cmodel.GetById(newCallId);
            byte[] oldtimer = call.Timer;
            output.WriteLine("New Call Retrieved");
            call.Notes += "\n Ordered new drive!";

            if (cmodel.Update(call) == UpdateStatus.Ok)
            {
                output.WriteLine("Call was updated " + call.Notes);
            }
            else
            {
                output.WriteLine("Call was not updated!");
            }

            call.Timer = oldtimer;
            call.Notes = "doesn't matter data is stale now";
            if (cmodel.Update(call) == UpdateStatus.Stale)
            {
                output.WriteLine("Call was not updated due to stale data");
            }

            cmodel = new CallModel();
            call   = cmodel.GetById(newCallId);

            if (cmodel.Delete(newCallId) == 1)
            {
                output.WriteLine("Call was deleted!");
            }
            else
            {
                output.WriteLine("Call was noe deleted");
            }
            Assert.Null(cmodel.GetById(newCallId));
        }
Пример #2
0
 //Get By Description
 public void GetByDescription()
 {
     try
     {
         Problem prb = _model.GetByDescription(Description);
         //Set the remaining properties
         Id = prb.Id;
     }
     catch (Exception ex)
     {
         Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
         throw ex;
     }
 }
Пример #3
0
        public void ComprehensiveModelTestsShouldReturnTrue()
        {
            CallModel     cmodel = new CallModel();
            EmployeeModel emodel = new EmployeeModel();
            ProblemModel  pmodel = new ProblemModel();
            Call          call   = new Call();

            call.DateOpened = DateTime.Now;
            call.DateClosed = null;
            call.OpenStatus = true;
            call.EmployeeId = emodel.GetByLastname("Jarocki").Id;
            call.TechId     = emodel.GetByLastname("Burner").Id;
            call.ProblemId  = pmodel.GetByDescription("Hard Drive Failure").Id;
            call.Notes      = "Kevin's drive is shot, Burner to fix it";
            int newCallId = cmodel.Add(call);

            Console.WriteLine("New Call Generated - Id = " + newCallId);
            call = cmodel.GetById(newCallId);
            byte[] oldtimer = call.Timer;
            Console.WriteLine("New Call Retrieved");
            call.Notes += "\n Ordered new RAM!";

            if (cmodel.Update(call) == UpdateStatus.Ok)
            {
                Console.WriteLine("Call was updated " + call.Notes);
            }
            else
            {
                Console.WriteLine("Call was not updated!");
            }

            call.Timer = oldtimer;
            if (cmodel.Update(call) == UpdateStatus.Stale)
            {
                Console.WriteLine("Call was not updated due to stale data");
            }
            cmodel = new CallModel();
            call   = cmodel.GetById(newCallId);

            if (cmodel.Delete(newCallId) == 1)
            {
                Console.WriteLine("call was deleted!");
            }
            else
            {
                Console.WriteLine("call was not deleted");
            }

            Assert.IsNull(cmodel.GetById(newCallId));
        }
Пример #4
0
 public void GetByDescription()
 {
     try
     {
         Problem prob = _model.GetByDescription(Description);
         Id          = prob.Id;
         Description = prob.Description;
         Timer       = Convert.ToBase64String(prob.Timer);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
     }
 }
Пример #5
0
        public void GetByDescription()
        {
            try
            {
                Problem pro = _model.GetByDescription(Description);
                Id          = pro.Id;
                Description = pro.Description;
            }

            catch (Exception ex)
            {
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }
        }
 public void GetByDescription()
 {
     try
     {
         // New Employee object that will be created with the Lastname
         Problem problem = _model.GetByDescription(Description);
         Description = problem.Description;
         Id          = problem.Id;
         //Timer = Convert.ToBase64String(problem.Timer);
     }
     catch (Exception ex)
     {
         Description = "not found";
         Console.WriteLine("Problem in" + GetType().Name + " " +
                           MethodBase.GetCurrentMethod().Name + " " + ex.Message);
         throw ex;
     }
 }
        public void GetByDescription()
        {
            try
            {
                Problems p = _model.GetByDescription(Description);
                Id          = p.Id;
                Description = p.Description;

                Timer = Convert.ToBase64String(p.Timer);
            }
            catch (NullReferenceException nex)
            {
                Description = "not found";
            }
            catch (Exception ex)
            {
                Description = "not found";
                Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }
        }