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();
        }
示例#3
0
        public void CustomBadRequestExecuteFallback()
        {
            HystrixCommandBase.RegisterCustomBadRequestExceptionChecker(NormalCheckerName, IsBadRequestException);

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

            command.Run();
        }
示例#4
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);
        }