Esempio n. 1
0
        public void ResponseSetsDataCorrectly()
        {
            var message = new HttpResponseMessage();
            var data    = new Object();
            var meetup  = new MeetupResponse <object>(message, data);

            Assert.Equal(data, meetup.Data);
        }
Esempio n. 2
0
        public void RateLimitNullByDefault()
        {
            var message = new HttpResponseMessage();
            var meetup  = new MeetupResponse <object>(message, null);

            Assert.Null(meetup.RateLimit);
            Assert.Null(meetup.RateLimitRemaining);
            Assert.Null(meetup.RateLimitResetSeconds);
        }
Esempio n. 3
0
        public void RateLimitsSetCorrectly()
        {
            var message = new HttpResponseMessage();

            message.Headers.Add(MeetupResponse.RateLimitHeader, "60");
            message.Headers.Add(MeetupResponse.RateLimitRemainingHeader, "38");
            message.Headers.Add(MeetupResponse.RateLimitResetSecondsHeader, "10");

            var meetup = new MeetupResponse <object>(message, null);

            Assert.Equal(60, meetup.RateLimit);
            Assert.Equal(38, meetup.RateLimitRemaining);
            Assert.Equal(10, meetup.RateLimitResetSeconds);
        }
Esempio n. 4
0
        public void PaginationLinksWorkCorrectly()
        {
            var nextLink = "https://api.meetup.com/find/locations?sign=true&photo-host=public&page=200&offset=2";
            var prevLink = "https://api.meetup.com/find/locations?sign=true&photo-host=public&page=200&offset=0";
            var message  = new HttpResponseMessage();

            message.Headers.Add("Link", $"<{nextLink}>; rel=\"next\"");
            message.Headers.Add("Link", $"<{prevLink}>; rel=\"prev\"");

            var meetup = new MeetupResponse <object>(message, null);

            Assert.NotNull(meetup.Previous);
            Assert.NotNull(meetup.Next);

            Assert.Equal("https://api.meetup.com/find/locations?sign=true&photo-host=public&page=200&offset=0", meetup.Previous.Url);
            Assert.Equal("https://api.meetup.com/find/locations?sign=true&photo-host=public&page=200&offset=2", meetup.Next.Url);
        }