protected override void InitializeContainer() { _provider = new UtilizationDataProviderMock(); CloudConfigurationManager.RegisterApplicationSettings(new ConfigurationOverride(CloudConfigurationManager.AppSettings).Set("UtilizationReportAggregationUnit", "1")); ObjectFactory.Container.Inject(typeof(IUtilizationDataProvider), _provider); ObjectFactory.Container.Inject <ITimer>(_timerService); }
public override void SetUp() { base.SetUp(); _provider = new UtilizationDataProviderMock(); CloudConfigurationManager.RegisterApplicationSettings(new ConfigurationOverride(CloudConfigurationManager.AppSettings) .Set("UtilizationReportAggregationUnit", "1") .Set("UtilizationSateRenewInterval", "1")); ObjectFactory.Container.Inject(typeof(IUtilizationDataProvider), _provider); ObjectFactory.Container.Inject <ITimer>(_timerService); }
public void CanInitialize() { CloudConfigurationManager.RegisterApplicationSettings(new ConfigurationOverride(CloudConfigurationManager.AppSettings) .Set("UtilizationReportAggregationUnit", "1") .Set("UtilizationSateRenewInterval", "1000")); _provider.SetOverheatingUsers("1", "2", "3"); var rateLimiter = ObjectFactory.GetInstance <IActivityExecutionRateLimitingService>(); Assert.IsFalse(rateLimiter.CheckActivityExecutionRate("1"), "User \"1\" should be banned"); Assert.IsTrue(rateLimiter.CheckActivityExecutionRate("4"), "User \"4\" should not be banned"); Assert.AreEqual(1, _provider.GetOverheatingUsersCount, "Should load overheating users from the provider only once"); }
public void Teardown() { CloudConfigurationManager.RegisterApplicationSettings(_originalSettings); }
private void ConfigureNoCache() { CloudConfigurationManager.RegisterApplicationSettings(new DisableCacheSettings(CloudConfigurationManager.AppSettings)); }