public void BadRequestWillExecuteFallback()
        {
            SampleHasFallbackIsolationCommand command = new SampleHasFallbackIsolationCommand(
                TestCommandKey,
                execute: () => { throw new BadRequestException(); },
                fallback: () => string.Empty);

            command.Run();
        }
예제 #2
0
        public void CustomBadRequestExecuteFallback()
        {
            HystrixCommandBase.RegisterCustomBadRequestExceptionChecker(NormalCheckerName, IsBadRequestException);

            SampleHasFallbackIsolationCommand command = new SampleHasFallbackIsolationCommand(
                TestCommandKey,
                execute: () => { throw new ArgumentOutOfRangeException(); },
                fallback: () => string.Empty);

            command.Run();
        }
예제 #3
0
        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);
        }