public void ReportException()
 {
     try
     {
         _logger.Log(ErrorLevel.Error, new System.Exception("test exception"));
     }
     catch
     {
         Assert.IsTrue(false);
     }
 }
Exemplo n.º 2
0
        public void ExceptionWhileTransformingPayloadAsync()
        {
            this._transformException = false;

            RollbarConfig loggerConfig =
                new RollbarConfig(RollbarUnitTestSettings.AccessToken)
            {
                Environment = RollbarUnitTestSettings.Environment,
            };

            loggerConfig.Transform = delegate { throw new NullReferenceException(); };
            using (IRollbar logger = RollbarFactory.CreateNew().Configure(loggerConfig))
            {
                logger.InternalEvent += Logger_InternalEvent;

                try
                {
                    this.IncrementCount <CommunicationEventArgs>();
                    logger.Log(ErrorLevel.Error, "test message");
                }
                catch
                {
                    logger.InternalEvent -= Logger_InternalEvent;
                    Assert.Fail("should never get here!");
                }

                this._signal.Wait();
                logger.InternalEvent -= Logger_InternalEvent;

                Assert.IsTrue(this._transformException);
            }
        }
Exemplo n.º 3
0
        public void LongReportIsAsync()
        {
            const int     maxCallLengthInMillisec = 50;
            TimeSpan      payloadSubmissionDelay  = TimeSpan.FromMilliseconds(3 * maxCallLengthInMillisec);
            RollbarConfig loggerConfig            =
                new RollbarConfig(RollbarUnitTestSettings.AccessToken)
            {
                Environment = RollbarUnitTestSettings.Environment,
            };

            loggerConfig.Transform = delegate { Thread.Sleep(payloadSubmissionDelay); };
            using (IRollbar logger = RollbarFactory.CreateNew().Configure(loggerConfig))
            {
                try
                {
                    this.IncrementCount <CommunicationEventArgs>();
                    Stopwatch sw = Stopwatch.StartNew();
                    logger.Log(ErrorLevel.Error, "test message");
                    sw.Stop();
                    Assert.IsTrue(sw.ElapsedMilliseconds < maxCallLengthInMillisec);
                    Thread.Sleep(payloadSubmissionDelay);
                }
                catch
                {
                    Assert.Fail("should never get here!");
                }
            }
        }
        public void ExceptionWhileTransformingPayloadAsync()
        {
            this._transformException = false;

            RollbarConfig loggerConfig =
                new RollbarConfig(RollbarUnitTestSettings.AccessToken)
            {
                Environment = RollbarUnitTestSettings.Environment,
            };

            loggerConfig.Transform = delegate { throw new NullReferenceException(); };
            IRollbar logger = RollbarFactory.CreateNew().Configure(loggerConfig);

            logger.InternalEvent += Logger_InternalEvent;

            try
            {
                logger.Log(ErrorLevel.Error, "test message");
            }
            catch
            {
                Assert.IsTrue(false);
            }

            this._signal.Wait();

            Assert.IsTrue(this._transformException);
        }
Exemplo n.º 5
0
 public void ReportMessage()
 {
     using (IRollbar logger = RollbarFactory.CreateNew().Configure(this._loggerConfig))
     {
         try
         {
             logger.Log(ErrorLevel.Error, "test message");
         }
         catch
         {
             Assert.IsTrue(false);
         }
     }
 }
Exemplo n.º 6
0
 public void ReportException()
 {
     using (IRollbar logger = RollbarFactory.CreateNew().Configure(this._loggerConfig))
     {
         try
         {
             logger.Log(ErrorLevel.Error, new System.Exception("test exception"));
         }
         catch
         {
             Assert.IsTrue(false);
         }
     }
 }
Exemplo n.º 7
0
 public void ReportMessage()
 {
     using (IRollbar logger = RollbarFactory.CreateNew().Configure(this._loggerConfig))
     {
         try
         {
             this.ExpectedCommunicationEventsTotal++;
             //TODO: implement and add SynchronousPackage around the payload object!!!
             logger.Log(ErrorLevel.Error, "test message");
         }
         catch
         {
             Assert.Fail("should never reach here!");
         }
     }
 }
        public void LongReportIsAsync()
        {
            RollbarConfig loggerConfig =
                new RollbarConfig(RollbarUnitTestSettings.AccessToken)
            {
                Environment = RollbarUnitTestSettings.Environment,
            };

            loggerConfig.Transform = delegate { System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(10 * maxCallLengthInMillisec)); };
            IRollbar logger = RollbarFactory.CreateNew().Configure(loggerConfig);

            try
            {
                logger.Log(ErrorLevel.Error, "test message");
            }
            catch
            {
                Assert.IsTrue(false);
            }
        }