public void IsMinimumWaitTimeMet_WhenConfiguredLessThanMinimum_UsesMinimum()
        {
            filePayload.MinimumWaitTimeSpan = new TimeSpan(0, 50, 0);
            fileDownloadDatabaseServiceMock.GetLastFileDownloadDateTime().Returns(dateTime.AddMinutes(-59));

            bool actual = InvokeIsMinimumWaitTimeMet();

            Assert.That(actual, Is.False);
        }
        public bool IsMinimumWaitTimeMet(FilePayload filePayload)
        {
            TimeSpan configuredMinimumWaitTimeSpan = filePayload.MinimumWaitTimeSpan;
            DateTime lastSuccessfulRun             = fileDownloadDatabaseService.GetLastFileDownloadDateTime();
            DateTime dateTimeNow = dateTimeService.DateTimeNow();

            if (dateTimeNow - lastSuccessfulRun < MinimumWait.TimeSpan)
            {
                return(false);
            }

            if (dateTimeNow - lastSuccessfulRun < configuredMinimumWaitTimeSpan)
            {
                return(false);
            }

            return(true);
        }
 private DateTime InvokeGetLastFileDownloadDateTime()
 {
     return(systemUnderTest.GetLastFileDownloadDateTime());
 }