public void TestThatLogExceptionThrowsArgumentNullExceptionIfDeliveryEngineConvertExceptionIsNull()
        {
            using (var exceptionLogger = new ExceptionLogger(GetPathForExceptionLogger()))
            {
                Assert.That(exceptionLogger, Is.Not.Null);

                DeliveryEngineConvertException exception = null;
                // ReSharper disable ExpressionIsAlwaysNull
                Assert.Throws <ArgumentNullException>(() => exceptionLogger.LogException(exception));
                // ReSharper restore ExpressionIsAlwaysNull
                exceptionLogger.Dispose();
            }
            Assert.That(GetNumberOfLogFiles(), Is.EqualTo(0));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Log a convert exception in the delivery engine.
 /// </summary>
 /// <param name="exception">Convert exception from the delivery engine.</param>
 public virtual void LogException(DeliveryEngineConvertException exception)
 {
     if (exception == null)
     {
         throw new ArgumentNullException("exception");
     }
     try
     {
         Trace.TraceError("{0} ({1}): {2}, StackTrace: {3}", exception.GetType().Name, exception.Information.ExceptionInfo, exception.Message, exception.StackTrace);
         Trace.Flush();
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch
     {
     }
     // ReSharper restore EmptyGeneralCatchClause
 }
Exemplo n.º 3
0
        public void TestThatConstructurDeliveryEngineConvertExceptionWithoutInnerException()
        {
            var fixture = new Fixture();

            fixture.Customize <IDeliveryEngineConvertExceptionInfo>(e => e.FromFactory(() => MockRepository.GenerateMock <IDeliveryEngineConvertExceptionInfo>()));
            var message     = fixture.CreateAnonymous <string>();
            var information = fixture.CreateAnonymous <IDeliveryEngineConvertExceptionInfo>();

            var exception = new DeliveryEngineConvertException(message, information);

            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.Information, Is.Not.Null);
            Assert.That(exception.Information, Is.EqualTo(information));
            Assert.That(exception.InnerException, Is.Null);
        }