コード例 #1
0
        public void TestAsyncCommandSuccessful()
        {
            Console.WriteLine(13 % 2);
            var result = HystrixCommandBase.RunCommandAsync <bool>("testasync", () =>
            {
                return(true);
            }, () =>
            {
                return(false);
            });

            Assert.AreEqual(true, result.Result);
        }
コード例 #2
0
        public void TestAsyncCommandFailedHaveFallbackFailed()
        {
            var result = HystrixCommandBase.RunCommandAsync <bool>("testasync", () =>
            {
                throw new Exception("failed");
            }, () => { throw new Exception("fall back failed"); });

            try
            {
                result.Wait();
            }
            catch { }
            Assert.AreEqual(true, result.IsFaulted);
        }