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); }
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); }
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); }