Esempio n. 1
0
        public void Should_set_next_attempt_based_on_num_calls(int calls, int minutes)
        {
            var @event = CreateEvent(calls);

            var requestResult = WebhookResult.Failed;
            var requestTime   = TimeSpan.FromMinutes(1);
            var requestDump   = "Dump";

            SetupSender(@event, requestDump, requestResult, requestTime);
            SetupPendingEvents(@event);

            var sut = new WebhookDequeuer(
                webhookSender,
                webhookEventRepository,
                webhookRepository,
                clock, A.Fake <ISemanticLog>());

            sut.Next();
            sut.Dispose();

            VerifyRepositories(@event, requestDump, requestResult, requestTime, now.Plus(Duration.FromMinutes(minutes)));
        }
Esempio n. 2
0
        public void Should_update_repositories_on_successful_requests()
        {
            var @event = CreateEvent(0);

            var requestResult = WebhookResult.Success;
            var requestTime   = TimeSpan.FromMinutes(1);
            var requestDump   = "Dump";

            SetupSender(@event, requestDump, requestResult, requestTime);
            SetupPendingEvents(@event);

            var sut = new WebhookDequeuer(
                webhookSender,
                webhookEventRepository,
                webhookRepository,
                clock, A.Fake <ISemanticLog>());

            sut.Next();
            sut.Dispose();

            VerifyRepositories(@event, requestDump, requestResult, requestTime, null);
        }