コード例 #1
0
        public void ExecuteWithRetryTest_Retry2Times()
        {
            IEurekaClient eureka = new EurekaClientFake()
            {
                EurekaServiceUrl      = KaryonConfig.Current.EurekaServiceUrls[0],
                ApplicationName       = KaryonConfig.Current.ApplicationName,
                ApplicationPort       = KaryonConfig.Current.ApplicationPort,
                ApplicationSecurePort = KaryonConfig.Current.ApplicationSecurePort
            };

            bool result = EurekaClientExecutor.Wrap(eureka).ExecuteWithRetry(() => eureka.Register(null), KaryonConfig.Current.EurekaServiceUrls);

            Assert.AreEqual(KaryonConfig.Current.EurekaServiceUrls[1], eureka.EurekaServiceUrl);
            Assert.AreEqual(false, result);
        }
コード例 #2
0
        public void ExecuteWithRetryTest_Try3TimesFail()
        {
            IEurekaClient eureka = new EurekaClientFake()
            {
                EurekaServiceUrl      = KaryonConfig.Current.EurekaServiceUrls[0],
                ApplicationName       = KaryonConfig.Current.ApplicationName,
                ApplicationPort       = KaryonConfig.Current.ApplicationPort,
                ApplicationSecurePort = KaryonConfig.Current.ApplicationSecurePort
            };

            (eureka as EurekaClientFake)._shouldErrorOut = null;

            bool result = EurekaClientExecutor.Wrap(eureka).ExecuteWithRetry(() => eureka.Register(null), 3);

            Assert.AreEqual(false, result);
        }