public LimitProviderBaseTests() { keyGenerator = A.Fake<ILimitKeyGenerator>(); appSetting = A.Fake<IAppSettings>(); limitProvider = new LimitProviderBase(keyGenerator, appSetting); }
public LimitProviderBaseTests() { keyGenerator = A.Fake <ILimitKeyGenerator>(); appSetting = A.Fake <IAppSettings>(); limitProvider = new LimitProviderBase(keyGenerator, appSetting); }
public AppSettingsLimitProvider(ILimitKeyGenerator keyGenerator, IAppSettings appSettings) { keyGenerator.ThrowIfNull(nameof(keyGenerator)); appSettings.ThrowIfNull(nameof(appSettings)); this.keyGenerator = keyGenerator; this.appSettings = appSettings; }
public RateLimitFeatureTests() { redisManager = A.Fake<IRedisClientsManager>(); limitProvider = A.Fake<ILimitProvider>(); keyGenerator = A.Fake<ILimitKeyGenerator>(); var fixture = new Fixture().Customize(new AutoFakeItEasyCustomization()); limit = fixture.Create<Limits>(); A.CallTo(() => limitProvider.GetLimits(A<IRequest>.Ignored)).Returns(limit); }
public RateLimitFeatureTests() { redisManager = A.Fake <IRedisClientsManager>(); limitProvider = A.Fake <ILimitProvider>(); keyGenerator = A.Fake <ILimitKeyGenerator>(); var fixture = new Fixture().Customize(new AutoFakeItEasyCustomization()); limit = fixture.Create <Limits>(); A.CallTo(() => limitProvider.GetLimits(A <IRequest> .Ignored)).Returns(limit); }
private void EnsureDependencies(IAppHost appHost) { if (KeyGenerator == null) { KeyGenerator = new LimitKeyGenerator(); } if (LimitProvider == null) { LimitProvider = new AppSettingsLimitProvider(KeyGenerator, appHost.AppSettings); } }
public LimitProviderBase(ILimitKeyGenerator keyGenerator, IAppSettings appSettings) { keyGenerator.ThrowIfNull(nameof(keyGenerator)); appSettings.ThrowIfNull(nameof(appSettings)); this.keyGenerator = keyGenerator; this.appSettings = appSettings; // This is purely to ensure that we always have a default limit defaultLimits = new LimitGroup { Limits = new List<LimitPerSecond> { new LimitPerSecond { Seconds = 60, Limit = DefaultPerMinute }, new LimitPerSecond { Seconds = 3600, Limit = DefaultPerHour } } }; }
public LimitProviderBase(ILimitKeyGenerator keyGenerator, IAppSettings appSettings) { keyGenerator.ThrowIfNull(nameof(keyGenerator)); appSettings.ThrowIfNull(nameof(appSettings)); this.keyGenerator = keyGenerator; this.appSettings = appSettings; // This is purely to ensure that we always have a default limit defaultLimits = new LimitGroup { Limits = new List <LimitPerSecond> { new LimitPerSecond { Seconds = 60, Limit = DefaultPerMinute }, new LimitPerSecond { Seconds = 3600, Limit = DefaultPerHour } } }; }
private void EnsureDependencies(IAppHost appHost) { if (KeyGenerator == null) KeyGenerator = new LimitKeyGenerator(); if (LimitProvider == null) LimitProvider = new LimitProviderBase(KeyGenerator, appHost.AppSettings); }