public void BadRequestWillExecuteFallback() { SampleHasFallbackIsolationCommand command = new SampleHasFallbackIsolationCommand( TestCommandKey, execute: () => { throw new BadRequestException(); }, fallback: () => string.Empty); command.Run(); }
public void CustomBadRequestExecuteFallback() { HystrixCommandBase.RegisterCustomBadRequestExceptionChecker(NormalCheckerName, IsBadRequestException); SampleHasFallbackIsolationCommand command = new SampleHasFallbackIsolationCommand( TestCommandKey, execute: () => { throw new ArgumentOutOfRangeException(); }, fallback: () => string.Empty); command.Run(); }
public void CustomBadRequestNotExecuteFallback_CheckerThrowException() { HystrixCommandBase.RegisterCustomBadRequestExceptionChecker(WithExceptionCheckerName, IsBadRequestExceptionWithException); SampleHasFallbackIsolationCommand command = new SampleHasFallbackIsolationCommand( TestCommandKey, execute: () => { throw new ArgumentOutOfRangeException(); }, fallback: () => string.Empty); string result = command.Run(); Assert.AreEqual(string.Empty, result); }