public void ConfigAllCommandSettingsFromConcreteClass()
 {
     Assert.IsFalse(ScenarioTestHelper.AreEqual(DefaultConfigSet, CustomConfigSet));
     new SampleIsolationCommand(TestCommandKey,
                                config: configSet => ScenarioTestHelper.SetCommandConfigFrom(configSet, CustomConfigSet));
     Assert.IsTrue(ScenarioTestHelper.AreEqual(CustomConfigSet, CommandComponents.ConfigSet));
 }
 public void ConfigAllCommandSettings()
 {
     Assert.IsFalse(ScenarioTestHelper.AreEqual(DefaultConfigSet, CustomConfigSet));
     HystrixCommandBase.ConfigCommand <string>(TestCommandKey,
                                               configSet => ScenarioTestHelper.SetCommandConfigFrom(configSet, CustomConfigSet));
     Assert.IsTrue(ScenarioTestHelper.AreEqual(CustomConfigSet, CommandComponents.ConfigSet));
 }
 public void ConfigCommand_Key_Domain_Config()
 {
     HystrixCommandBase.ConfigCommand <string>(TestCommandKey, TestDomain,
                                               config => ScenarioTestHelper.SetCommandConfigFrom(config, CustomConfigSet));
     Assert.AreEqual(TestDomain, CommandComponents.CommandInfo.Domain, true);
     Assert.IsTrue(ScenarioTestHelper.AreEqual(CustomConfigSet, CommandComponents.ConfigSet));
 }
 public void Config_Key_Group_Domain()
 {
     SL.Config(TestCommandKey, TestGroupKey, TestDomain);
     Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
     Assert.AreEqual(TestGroupKey, CommandComponents.CommandInfo.GroupKey, true);
     Assert.AreEqual(TestDomain, CommandComponents.CommandInfo.Domain, true);
     Assert.IsTrue(ScenarioTestHelper.AreEqual(DefaultConfigSet, CommandComponents.ConfigSet));
 }
 public void Config_Key_Group_Config()
 {
     SL.Config(TestCommandKey, TestGroupKey, configSet => ScenarioTestHelper.SetCommandConfigFrom(configSet, CustomConfigSet));
     Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
     Assert.AreEqual(TestGroupKey, CommandComponents.CommandInfo.GroupKey, true);
     Assert.AreEqual(CommandDomains.Default, CommandComponents.CommandInfo.Domain, true);
     Assert.IsTrue(ScenarioTestHelper.AreEqual(CustomConfigSet, CommandComponents.ConfigSet));
 }
 public void Config_Key_Group_Domain_Config_Default()
 {
     SL.Config(TestCommandKey, null, null, config => {});
     Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
     Assert.AreEqual(HystrixCommandBase.DefaultGroupKey, CommandComponents.CommandInfo.GroupKey, true);
     Assert.AreEqual(CommandDomains.Default, CommandComponents.CommandInfo.Domain, true);
     Assert.IsTrue(ScenarioTestHelper.AreEqual(DefaultConfigSet, CommandComponents.ConfigSet));
 }
 public void ConfigCommandWithDefaultConfigFromConcreteClass()
 {
     new SampleIsolationCommand(TestCommandKey, config: c => { });
     Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
     Assert.AreEqual(HystrixCommandBase.DefaultGroupKey, CommandComponents.CommandInfo.GroupKey, true);
     Assert.AreEqual(CommandDomains.Default, CommandComponents.CommandInfo.Domain, true);
     Assert.IsTrue(ScenarioTestHelper.AreEqual(DefaultConfigSet, CommandComponents.ConfigSet));
 }
 public void ConfigCommandWithDefaultConfig()
 {
     HystrixCommandBase.ConfigCommand <string>(TestCommandKey, config => {});
     Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
     Assert.AreEqual(HystrixCommandBase.DefaultGroupKey, CommandComponents.CommandInfo.GroupKey, true);
     Assert.AreEqual(CommandDomains.Default, CommandComponents.CommandInfo.Domain, true);
     Assert.IsTrue(ScenarioTestHelper.AreEqual(DefaultConfigSet, CommandComponents.ConfigSet));
 }
        public void OverrideConfigInSubclass_WithoutCustomConfig()
        {
            SampleIsolationCommandWithOverriddenConfig command = new SampleIsolationCommandWithOverriddenConfig(TestCommandKey);

            Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
            Assert.AreEqual(HystrixCommandBase.DefaultGroupKey, CommandComponents.CommandInfo.GroupKey, true);
            Assert.AreEqual(CommandDomains.Default, CommandComponents.CommandInfo.Domain, true);
            Assert.IsTrue(ScenarioTestHelper.AreEqual(DefaultConfigSet, CommandComponents.ConfigSet));
        }
        public void SemaphoreIsolation_Key_GroupKey_Domain()
        {
            SL instance = new SL(TestCommandKey, TestGroupKey, TestDomain);

            Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
            Assert.AreEqual(TestGroupKey, CommandComponents.CommandInfo.GroupKey, true);
            Assert.AreEqual(TestDomain, CommandComponents.CommandInfo.Domain, true);
            Assert.IsTrue(ScenarioTestHelper.AreEqual(DefaultConfigSet, CommandComponents.ConfigSet));
        }
        public void SemaphoreIsolation_Key()
        {
            SL instance = new SL(TestCommandKey);

            Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
            Assert.AreEqual(HystrixCommandBase.DefaultGroupKey, CommandComponents.CommandInfo.GroupKey, true);
            Assert.AreEqual(CommandDomains.Default, CommandComponents.CommandInfo.Domain, true);
            Assert.IsTrue(ScenarioTestHelper.AreEqual(DefaultConfigSet, CommandComponents.ConfigSet));
        }
        public void SemaphoreIsolation_Key_GroupKey_Domain_Config()
        {
            SL instance = new SL(TestCommandKey, TestGroupKey, TestDomain,
                                 configSet => ScenarioTestHelper.SetCommandConfigFrom(configSet, CustomConfigSet));

            Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
            Assert.AreEqual(TestGroupKey, CommandComponents.CommandInfo.GroupKey, true);
            Assert.AreEqual(TestDomain, CommandComponents.CommandInfo.Domain, true);
            Assert.IsTrue(ScenarioTestHelper.AreEqual(CustomConfigSet, CommandComponents.ConfigSet));
        }
        public void OverrideConfigInSubclass_WithCustomConfig_ConcreteFirst3()
        {
            SampleIsolationCommandWithOverriddenConfig.InitConfigSet = CustomConfigSet;
            SampleIsolationCommandWithOverriddenConfig command = new SampleIsolationCommandWithOverriddenConfig(TestCommandKey,
                                                                                                                config: configSet => { configSet.CommandTimeoutInMilliseconds = 111; });

            Assert.AreEqual(TestCommandKey, CommandComponents.CommandInfo.Key, true);
            Assert.AreEqual(HystrixCommandBase.DefaultGroupKey, CommandComponents.CommandInfo.GroupKey, true);
            Assert.AreEqual(CommandDomains.Default, CommandComponents.CommandInfo.Domain, true);
            Assert.IsTrue(ScenarioTestHelper.AreEqual(CustomConfigSet, CommandComponents.ConfigSet));
        }
 public void Config_Key_Group_Domain_MaxConcurrentCount_Timeout_RequestCountThreshold_ErrorThresholdPercentage_FallbackMaxConcurrentCount()
 {
     SL.Config(TestCommandKey, TestGroupKey, TestDomain,
               CustomConfigSet.CommandMaxConcurrentCount, CustomConfigSet.CommandTimeoutInMilliseconds,
               CustomConfigSet.CircuitBreakerRequestCountThreshold, CustomConfigSet.CircuitBreakerErrorThresholdPercentage,
               CustomConfigSet.FallbackMaxConcurrentCount);
     Assert.AreEqual(TestGroupKey, CommandComponents.CommandInfo.GroupKey, true);
     Assert.AreEqual(TestDomain, CommandComponents.CommandInfo.Domain, true);
     Assert.IsFalse(ScenarioTestHelper.AreEqual(CustomConfigSet, CommandComponents.ConfigSet));
     Assert.AreEqual(CustomConfigSet.CommandMaxConcurrentCount, CommandComponents.ConfigSet.CommandMaxConcurrentCount);
     Assert.AreEqual(CustomConfigSet.CommandTimeoutInMilliseconds, CommandComponents.ConfigSet.CommandTimeoutInMilliseconds);
     Assert.AreEqual(CustomConfigSet.CircuitBreakerRequestCountThreshold, CommandComponents.ConfigSet.CircuitBreakerRequestCountThreshold);
     Assert.AreEqual(CustomConfigSet.CircuitBreakerErrorThresholdPercentage, CommandComponents.ConfigSet.CircuitBreakerErrorThresholdPercentage);
     Assert.AreEqual(CustomConfigSet.FallbackMaxConcurrentCount, CommandComponents.ConfigSet.FallbackMaxConcurrentCount);
 }