예제 #1
0
            public void ShouldNotThrowIfHeaderNotPresent(
                Bucket bucket,
                [Target] DefaultBucketService service
                )
            {
                var response = new HttpResponseMessage();

                Action func = () => service.UpdateBucketResetAfter(bucket, response);

                func.Should().NotThrow();
            }
예제 #2
0
            public void ShouldNotThrowIfHeaderValueIsNotANumber(
                Bucket bucket,
                [Target] DefaultBucketService service
                )
            {
                var response = new HttpResponseMessage();

                response.Headers.Add("x-ratelimit-reset", new[] { "asdf" });

                Action func = () => service.UpdateBucketResetAfter(bucket, response);

                func.Should().NotThrow();
            }
예제 #3
0
            public void ShouldUpdateResetAfterFromHeaderValue(
                Bucket bucket,
                [Target] DefaultBucketService service
                )
            {
                var response = new HttpResponseMessage();

                response.Headers.Add("x-ratelimit-reset", new[] { "1621277586" });

                service.UpdateBucketResetAfter(bucket, response);

                bucket.ResetAfter.Should().Be(DateTimeOffset.FromUnixTimeSeconds(1621277586));
            }