private void CheckExceptionExists()
 {
     using (RiftEntities context = new RiftEntities())
     {
         GCTSC_ExceptionLogging exception = (from ex in context.GCTSC_ExceptionLogging.Where(ex => ex.Message.Contains("Lets see if we") &&
                                                                                             ex.InnerMessage.Contains("with an inner"))
                                             select ex).FirstOrDefault();
         Assert.IsNotNull(exception);
     }
 }
Beispiel #2
0
 private void SaveException(GCTSC_ExceptionLogging exception)
 {
     using (RiftEntities context = new RiftEntities())
     {
         try
         {
             context.GCTSC_ExceptionLogging.Add(exception);
             context.SaveChanges();
         }
         catch (Exception ex) { throw ex; }
     }
 }
Beispiel #3
0
        public void LogException(Exception givenException)
        {
            GCTSC_ExceptionLogging exception = new GCTSC_ExceptionLogging()
            {
                Message    = givenException.Message,
                StackTrace = givenException.StackTrace,
                Created    = DateTime.Now
            };

            if (givenException.InnerException != null)
            {
                exception.InnerMessage = givenException.InnerException.Message;
            }
            SaveException(exception);
        }