UpdateFromApi() 공개 메소드

public UpdateFromApi ( TwitterDataModel limit ) : void
limit TwitterDataModel
리턴 void
예제 #1
0
        public void UpdateFromApiTest2()
        {
            var status = new TwitterApiStatus();

            var eventCalled = false;

            status.AccessLimitUpdated += (s, e) => eventCalled = true;

            var apiResponse = new TwitterDataModel.RateLimitStatus
            {
                HourlyLimit        = 150,
                RemainingHits      = 100,
                ResetTime          = "Tue Jan 01 00:00:00 +0000 2013",
                ResetTimeInSeconds = 1356998400,
                Photos             = null,
            };

            status.UpdateFromApi(apiResponse);

            var rateLimit = status.AccessLimit;

            Assert.That(rateLimit.AccessLimitCount, Is.EqualTo(150));
            Assert.That(rateLimit.AccessLimitRemain, Is.EqualTo(100));
            Assert.That(rateLimit.AccessLimitResetDate, Is.EqualTo(new DateTime(2013, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()));

            Assert.That(status.MediaUploadLimit, Is.Null);

            Assert.That(eventCalled, Is.True);
        }
예제 #2
0
        public void UpdateFromApiTest3()
        {
            var status = new TwitterApiStatus();

            var eventCalled = false;

            status.AccessLimitUpdated += (s, e) => eventCalled = true;

            Assert.That(() => status.UpdateFromApi(null), Throws.TypeOf <ArgumentNullException>());

            Assert.That(status.AccessLimit, Is.Null);
            Assert.That(status.MediaUploadLimit, Is.Null);

            Assert.That(eventCalled, Is.False);
        }
예제 #3
0
        public void UpdateFromApiTest3()
        {
            var status = new TwitterApiStatus();

            var eventCalled = false;
            status.AccessLimitUpdated += (s, e) => eventCalled = true;

            Assert.That(() => status.UpdateFromApi(null), Throws.TypeOf<ArgumentNullException>());

            Assert.That(status.AccessLimit, Is.Null);
            Assert.That(status.MediaUploadLimit, Is.Null);

            Assert.That(eventCalled, Is.False);
        }
예제 #4
0
        public void UpdateFromApiTest2()
        {
            var status = new TwitterApiStatus();

            var eventCalled = false;
            status.AccessLimitUpdated += (s, e) => eventCalled = true;

            var apiResponse = new TwitterDataModel.RateLimitStatus
            {
                HourlyLimit = 150,
                RemainingHits = 100,
                ResetTime = "Tue Jan 01 00:00:00 +0000 2013",
                ResetTimeInSeconds = 1356998400,
                Photos = null,
            };

            status.UpdateFromApi(apiResponse);

            var rateLimit = status.AccessLimit;
            Assert.That(rateLimit.AccessLimitCount, Is.EqualTo(150));
            Assert.That(rateLimit.AccessLimitRemain, Is.EqualTo(100));
            Assert.That(rateLimit.AccessLimitResetDate, Is.EqualTo(new DateTime(2013, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()));

            Assert.That(status.MediaUploadLimit, Is.Null);

            Assert.That(eventCalled, Is.True);
        }