public void ThrowsReplacedExceptionWhenPostHandlingIsThrowNewExceptionAndExceptionShouldBeHandled() { var originalException = new DBConcurrencyException(); BusinessException thrownException = ExceptionAssertHelper.Throws <BusinessException>(() => this.exceptionManager.HandleException(originalException, "Replace DBConcurrencyException with BusinessException, ThrowNewException postHandling")); Assert.IsNotNull(thrownException); Assert.IsTrue(typeof(BusinessException).IsAssignableFrom(thrownException.GetType())); }
public void TestCreateHttpClientExcecaoConfiguracao() { // Reconfigura service para gerar exceção BusinessException exception = Assert.ThrowsException <BusinessException>(() => { RestClient client = new RestClient(""); } ); Assert.IsNotNull(exception); Assert.IsInstanceOfType(exception.GetType(), typeof(BusinessException).GetType()); }
public void TestCreateHttpClientExcecao() { IConfiguration config = ConfigurationMock.SetupForFailure(); this.BaseAddress = config.GetSection("Host").Value; BusinessException exception = Assert.ThrowsException <BusinessException>(() => { RestClient client = new RestClient(this.BaseAddress); } ); Assert.IsNotNull(exception); Assert.IsInstanceOfType(exception.GetType(), typeof(BusinessException).GetType()); }
public void Process(Exception ex) { var bex = new BusinessException(); if (bex.GetType() == typeof(BusinessException)) { bex = (BusinessException)ex; } else { bex = new BusinessException(0, ex); } ProcessBusinessException(bex); }
internal static StatusCodeResult GetStatusCode(this BusinessException ex) => ExceptionManagement[ex.GetType()];