Example #1
0
 public bool Equals(ApiLimit obj)
 {
     return(obj != null &&
            this.AccessLimitCount == obj.AccessLimitCount &&
            this.AccessLimitRemain == obj.AccessLimitRemain &&
            this.AccessLimitResetDate == obj.AccessLimitResetDate);
 }
Example #2
0
 public bool Equals(ApiLimit obj)
 {
     return obj != null &&
         this.AccessLimitCount == obj.AccessLimitCount &&
         this.AccessLimitRemain == obj.AccessLimitRemain &&
         this.AccessLimitResetDate == obj.AccessLimitResetDate;
 }
Example #3
0
 private void AddListViewItem(string endpoint, ApiLimit apiLimit, ListViewGroup group)
 {
     var item = new ListViewItem(
         new string[] {
             endpoint,
             apiLimit.AccessLimitRemain + "/" + apiLimit.AccessLimitCount,
             apiLimit.AccessLimitResetDate.ToString()
         });
     item.Group = group;
     this.ListViewApi.Items.Add(item);
 }
Example #4
0
        public void UpdateFromHeader(IDictionary <string, string> header, string endpointName)
        {
            var rateLimit = TwitterApiStatus.ParseRateLimit(header, "X-Rate-Limit-");

            if (rateLimit != null)
            {
                this.AccessLimit[endpointName] = rateLimit;
            }

            var mediaLimit = TwitterApiStatus.ParseRateLimit(header, "X-MediaRateLimit-");

            if (mediaLimit != null)
            {
                this.MediaUploadLimit = mediaLimit;
            }

            var accessLevel = TwitterApiStatus.ParseAccessLevel(header, "X-Access-Level");

            if (accessLevel.HasValue)
            {
                this.AccessLevel = accessLevel.Value;
            }
        }
Example #5
0
        public void EqualsTest(object obj2, bool expected)
        {
            var obj1 = new ApiLimit(150, 100, new DateTimeUtc(2013, 1, 1, 0, 0, 0));

            Assert.Equal(expected, obj1.Equals(obj2));
        }
Example #6
0
 public void Reset()
 {
     this.AccessLevel = TwitterApiAccessLevel.Anonymous;
     this.AccessLimit.Clear();
     this.MediaUploadLimit = null;
 }
Example #7
0
        public void EqualsTest(object obj2, bool expect)
        {
            var obj1 = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));

            Assert.That(obj1.Equals(obj2), Is.EqualTo(expect));
        }
        public void UpdateFromHeader(IDictionary<string, string> header, string endpointName)
        {
            var rateLimit = TwitterApiStatus.ParseRateLimit(header, "X-Rate-Limit-");
            if (rateLimit != null)
                this.AccessLimit[endpointName] = rateLimit;

            var mediaLimit = TwitterApiStatus.ParseRateLimit(header, "X-MediaRateLimit-");
            if (mediaLimit != null)
                this.MediaUploadLimit = mediaLimit;

            var accessLevel = TwitterApiStatus.ParseAccessLevel(header, "X-Access-Level");
            if (accessLevel.HasValue)
                this.AccessLevel = accessLevel.Value;
        }
 public void Reset()
 {
     this.AccessLevel = TwitterApiAccessLevel.Anonymous;
     this.AccessLimit.Clear();
     this.MediaUploadLimit = null;
 }
Example #10
0
        public void EqualsTest(object obj2, bool expect)
        {
            var obj1 = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));

            Assert.That(obj1.Equals(obj2), Is.EqualTo(expect));
        }
Example #11
0
        public void UpdateFromApi(TwitterDataModel.RateLimitStatus limit)
        {
            if (limit == null)
                throw new ArgumentNullException();

            this.AccessLimit = new ApiLimit(limit.HourlyLimit, limit.RemainingHits, MyCommon.DateTimeParse(limit.ResetTime));

            var mediaLimit = limit.Photos;
            if (mediaLimit != null)
            {
                this.MediaUploadLimit = new ApiLimit(mediaLimit.DailyLimit, mediaLimit.RemainingHits, MyCommon.DateTimeParse(mediaLimit.ResetTime));
            }
        }
Example #12
0
        public void UpdateFromHeader(IDictionary<string, string> header)
        {
            var rateLimit = TwitterApiStatus.ParseRateLimit(header);
            if (rateLimit != null)
                this.AccessLimit = rateLimit;

            var mediaLimit = TwitterApiStatus.ParseMediaRateLimit(header);
            if (mediaLimit != null)
                this.MediaUploadLimit = mediaLimit;

            var accessLevel = TwitterApiStatus.ParseAccessLevel(header);
            if (accessLevel.HasValue)
                this.AccessLevel = accessLevel.Value;
        }
Example #13
0
        public void ParseRateLimitTest(IDictionary <string, string> header, ApiLimit expect)
        {
            var limit = TwitterApiStatus.ParseRateLimit(header, "X-RateLimit-");

            Assert.That(limit, Is.EqualTo(expect));
        }
Example #14
0
 public void ParseRateLimitTest(IDictionary<string, string> header, ApiLimit expected)
 {
     var limit = TwitterApiStatus.ParseRateLimit(header, "X-RateLimit-");
     Assert.Equal(expected, limit);
 }
Example #15
0
        public void ParseRateLimitTest(IDictionary <string, string> header, ApiLimit expected)
        {
            var limit = TwitterApiStatus.ParseRateLimit(header, "X-RateLimit-");

            Assert.Equal(expected, limit);
        }
Example #16
0
 public void ParseRateLimitTest(IDictionary<string, string> header, ApiLimit expect)
 {
     var limit = TwitterApiStatus.ParseRateLimit(header);
     Assert.That(limit, Is.EqualTo(expect));
 }
Example #17
0
        public void EqualsTest(object obj2, bool expected)
        {
            var obj1 = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));

            Assert.Equal(expected, obj1.Equals(obj2));
        }