Ejemplo n.º 1
0
            public void ShouldNotThrowIfHeaderNotPresent(
                Bucket bucket,
                [Target] DefaultBucketService service
                )
            {
                var response = new HttpResponseMessage();

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

                func.Should().NotThrow();
            }
Ejemplo n.º 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();
            }
Ejemplo n.º 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));
            }