public void RunCommandSuccessAndFallbackFailFromConcreteClass() { string expected = string.Empty; string actual = new SampleHasFallbackIsolationCommand(TestCommandKey, expectedResult: expected, execute: () => expected, fallback: () => { throw new Exception(); }).Run(); Assert.AreEqual(expected, actual); }
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); }