public void should_retry_send_three_times_and_then_throw() { var retries = 0; var subscription = new Subscription { Endpoint = "http://localhost" }; _subscriptionStorage.ByPartnerId(_partnerId).Returns(subscription); SystemClock.Sleep = timespan => { Assert.That(timespan.TotalSeconds, Is.EqualTo(_apiPushServiceConfiguration.RetryDelayInSeconds * ++retries)); }; _pushSender .WhenForAnyArgs(x => x.Send(null, null)) .Do(x => { throw new Exception(); }); var exception = Assert.Throws<RetryPolicyException>(() => _consumer.Consume(_itemUpdated)); Assert.That(exception.RetryCount, Is.EqualTo(3)); _pushSender.ReceivedWithAnyArgs(4).Send(null, null); }
public void should_send_push_if_subscription_exists() { var subscription = new Subscription { Endpoint = "http://localhost" }; _subscriptionStorage.ByPartnerId(_partnerId).Returns(subscription); _consumer.Consume(_itemUpdated); _pushSender.Received().Send(_itemUpdated, subscription.Endpoint); }
public void should_throw_if_malformatted_uri() { var subscription = new Subscription { Endpoint = "Fake" }; _subscriptionStorage.ByPartnerId(_partnerId).Returns(subscription); _consumer.Consume(_itemUpdated); }