public void CanProceed_Have_To_Refresh_Status() { var client = new ExpiringRateLimitStatusProvider(); var gov = new TwitterGovernor(client, new SettingsProvider()); Assert.IsTrue(gov.CanProceed); Assert.That(client.CallCount, Is.EqualTo(2)); }
public void CanProceed() { var provider = new Mock<IRateLimitStatusProvider>(); provider.Setup(c => c.GetRateLimitStatus()) .Returns(new RateLimitStatus { HourlyLimit = 100, RemainingHits = 100, ResetTime = DateTime.Now.AddHours(5) }) .AtMostOnce(); var gov = new TwitterGovernor(provider.Object, new SettingsProvider()); Assert.IsTrue(gov.CanProceed); provider.Verify(c => c.GetRateLimitStatus(), Times.Once()); }