コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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");
        }
コード例 #4
0
 public void Teardown()
 {
     CloudConfigurationManager.RegisterApplicationSettings(_originalSettings);
 }
コード例 #5
0
 private void ConfigureNoCache()
 {
     CloudConfigurationManager.RegisterApplicationSettings(new DisableCacheSettings(CloudConfigurationManager.AppSettings));
 }