private void CheckForChangeTracking()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ChangeTracking ctRecord = (from ct in context.GCTSC_ChangeTracking.Where(ct => ct.Accountno == _roTestHelper._testAccountno)
                                          select ct).FirstOrDefault();
         Assert.IsTrue(ctRecord != null);
     }
 }
 private void SaveResponseInformation(GCTSC_ChangeTracking ctRecord, List <ResponseDetails> responses)
 {
     foreach (ResponseDetails response in responses)
     {
         if (response.SendRequest == 0)
         {
             SaveGeneralRequestInformation(response, ctRecord);
         }
         else
         {
             SaveUpdateRequestInformation(response, ctRecord);
         }
     }
 }
        private void SaveGeneralRequestInformation(ResponseDetails response, GCTSC_ChangeTracking ctRecord)
        {
            GCTSC_ChangeTracking_Requests request = new GCTSC_ChangeTracking_Requests()
            {
                ChangeTrackingId = ctRecord.Id,
                ResponseCode     = response.SendResponse.ToString(),
                ResponseContent  = response.ResponseContent,
                URL = response.URL
            };

            using (RiftEntities context = new RiftEntities())
            {
                try
                {
                    context.GCTSC_ChangeTracking_Requests.Add(request);
                    context.SaveChanges();
                }
                catch (Exception ex) { throw ex; }
            }
        }
 private void CheckForChangeTrackingRequest()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ChangeTracking ctRecord = (from ct in context.GCTSC_ChangeTracking.Where(ct => ct.Accountno == _roTestHelper._testAccountno)
                                          select ct).FirstOrDefault();
         if (ctRecord == null)
         {
             throw new ArgumentNullException("ctRecord");
         }
         else
         {
             GCTSC_ChangeTracking_Requests ctrRecord = (from ctr in context.GCTSC_ChangeTracking_Requests.Where(
                                                            ctr => ctr.ChangeTrackingId == ctRecord.Id &&
                                                            ctr.ResponseCode == "OK"
                                                            )
                                                        select ctr).FirstOrDefault();
             Assert.IsTrue(ctrRecord != null);
         }
     }
 }
        public void Log(ResultsObject resultObject)
        {
            GCTSC_ChangeTracking ctRecord = new GCTSC_ChangeTracking()
            {
                Accountno = resultObject.Accountno,
                Created   = DateTime.Now
            };

            using (RiftEntities context = new RiftEntities())
            {
                try
                {
                    context.GCTSC_ChangeTracking.Add(ctRecord);
                    context.SaveChanges();
                }
                catch (Exception ex) { throw ex; }
            }

            if (ctRecord.Id > 0 && resultObject.Responses.Count > 0)
            {
                SaveResponseInformation(ctRecord, resultObject.Responses);
            }
        }
 private void CheckForChangeTrackingUpdateRequest()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ChangeTracking ctRecord = (from ct in context.GCTSC_ChangeTracking.Where(ct => ct.Accountno == _roTestHelper._testAccountno)
                                          select ct).FirstOrDefault();
         if (ctRecord == null)
         {
             throw new ArgumentNullException("ctRecord");
         }
         else
         {
             GCTSC_ChangeTracking_UpdateRequests cturRecord = (from ctur in context.GCTSC_ChangeTracking_UpdateRequests.Where(
                                                                   ctur => ctur.ChangeTrackingId == ctRecord.Id &&
                                                                   ctur.ResponseCode == "OK" &&
                                                                   ctur.Change == "LASTNAME" &&
                                                                   ctur.ResponseContent.Contains(@"{""id"":1,""first_name"":""TestChange"",""goldmine_customer_number"":165992")
                                                                   )
                                                               select ctur).FirstOrDefault();
             Assert.IsTrue(cturRecord != null);
         }
     }
 }