public void TestAtConstructorInitiererIntranetGuiSystemExceptionUdenInnerException() { var fixture = new Fixture(); var message = fixture.Create <string>(); var exception = new IntranetGuiSystemException(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); }
/// <summary> /// Håndtering af exception ved udførelse af en kommando. /// </summary> /// <param name="exception">Exception.</param> /// <param name="parameter">Parameter, som kommanoden er blevet kaldt med.</param> protected override void HandleException(Exception exception, object parameter) { IntranetGuiCommandException commandException = null; IntranetGuiSystemException systemException = null; try { if (exception is IntranetGuiCommandException) { base.HandleException(exception, parameter); return; } if (exception is IntranetGuiValidationException) { commandException = new IntranetGuiCommandException(Resource.GetExceptionMessage(ExceptionMessage.ErrorPostingAccountingLine), exception.Message, this, parameter, exception); base.HandleException(commandException, parameter); return; } if (exception is IntranetGuiBusinessException) { commandException = new IntranetGuiCommandException(Resource.GetExceptionMessage(ExceptionMessage.ErrorPostingAccountingLine), exception.Message, this, parameter, exception); base.HandleException(commandException, parameter); return; } if (exception is IntranetGuiRepositoryException) { commandException = new IntranetGuiCommandException(Resource.GetExceptionMessage(ExceptionMessage.ErrorPostingAccountingLine), Resource.GetExceptionMessage(ExceptionMessage.ErrorUpdateFinansstyringRepository), this, _finansstyringRepository, exception); base.HandleException(commandException, parameter); return; } if (exception is IntranetGuiSystemException) { base.HandleException(exception, parameter); return; } systemException = new IntranetGuiSystemException(Resource.GetExceptionMessage(ExceptionMessage.CommandError, "BogføringAddCommand", exception.Message), exception); base.HandleException(systemException, parameter); } finally { if (OnError != null) { OnError.Invoke(this, new HandleExceptionEventArgs(commandException ?? systemException ?? exception)); } } }