Пример #1
0
        public void ProcessRequest_CallsGetLimits()
        {
            var mockHttpRequest = new MockHttpRequest();

            A.CallTo(() => limitProvider.GetLimits(mockHttpRequest)).Returns(null);

            var feature = GetSut();

            feature.ProcessRequest(mockHttpRequest, new MockHttpResponse(), null);

            A.CallTo(() => limitProvider.GetLimits(mockHttpRequest)).MustHaveHappened();
        }
        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);
        }
Пример #3
0
        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);
        }