public void TestThatConstructurDeliveryEngineSystemExceptionWithoutInnerException()
        {
            var fixture = new Fixture();
            var message = fixture.CreateAnonymous <string>();

            var exception = new DeliveryEngineSystemException(message);

            Assert.That(exception, Is.Not.Null);
            Assert.That(exception.Message, Is.Not.Null);
            Assert.That(exception.Message, Is.Not.Empty);
            Assert.That(exception.Message, Is.EqualTo(message));
            Assert.That(exception.InnerException, Is.Null);
        }
        public void TestThatLogExceptionThrowsArgumentNullExceptionIfDeliveryEngineSystemExceptionIsNull()
        {
            using (var exceptionLogger = new ExceptionLogger(GetPathForExceptionLogger()))
            {
                Assert.That(exceptionLogger, Is.Not.Null);

                DeliveryEngineSystemException exception = null;
                // ReSharper disable ExpressionIsAlwaysNull
                Assert.Throws <ArgumentNullException>(() => exceptionLogger.LogException(exception));
                // ReSharper restore ExpressionIsAlwaysNull
                exceptionLogger.Dispose();
            }
            Assert.That(GetNumberOfLogFiles(), Is.EqualTo(0));
        }
        public void TestThatConstructorThrowsDeliveryEngineSystemExceptionWhenAppSettingCollectionDoesNotContainIncludeEmptyTables()
        {
            NameValueCollection appSettingCollection = BuildAppSettingCollection();

            // ReSharper disable ObjectCreationAsStatement
            DeliveryEngineSystemException result = Assert.Throws <DeliveryEngineSystemException>(() => new ConfigurationRepository(appSettingCollection));

            // ReSharper restore ObjectCreationAsStatement

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Message, Is.Not.Null);
            Assert.That(result.Message, Is.Not.Empty);
            Assert.That(result.Message, Is.EqualTo(Resource.GetExceptionMessage(ExceptionMessage.ApplicationSettingMissing, "IncludeEmptyTables")));
            Assert.That(result.InnerException, Is.Null);
        }
Example #4
0
 /// <summary>
 /// Log a system exception in the delivery engine.
 /// </summary>
 /// <param name="exception">Repository exception from the delivery engine.</param>
 public virtual void LogException(DeliveryEngineSystemException exception)
 {
     if (exception == null)
     {
         throw new ArgumentNullException("exception");
     }
     try
     {
         Trace.TraceError("{0}: {1}, StackTrace: {2}", exception.GetType().Name, exception.Message, exception.StackTrace);
         Trace.Flush();
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch
     {
     }
     // ReSharper restore EmptyGeneralCatchClause
 }