public void ShouldBeTrueWhenRemoteConfigHasNeverBeenFetched() { DateTimeOffset?nullDateTimeOffset = null; KeyValueStorage.GetDateTimeOffset(LastFetchAtKey).Returns(nullDateTimeOffset); UpdateRemoteConfigCacheService = new UpdateRemoteConfigCacheService(TimeService, KeyValueStorage, FetchRemoteConfigService); var needsToUpdateStoredRemoteConfigData = UpdateRemoteConfigCacheService.NeedsToUpdateStoredRemoteConfigData(); Assert.IsTrue(needsToUpdateStoredRemoteConfigData); }
public void ShouldBeFalseWhenRemoteConfigHasBeenFetchedLessThan12HoursAndHalfAgo() { var now = new DateTimeOffset(2019, 1, 1, 12, 0, 0, TimeSpan.Zero); TimeService.CurrentDateTime.Returns(now); var thirteenHoursAgo = now.AddHours(-11); KeyValueStorage.GetDateTimeOffset(LastFetchAtKey).Returns(thirteenHoursAgo); UpdateRemoteConfigCacheService = new UpdateRemoteConfigCacheService(TimeService, KeyValueStorage, FetchRemoteConfigService); var needsToUpdateStoredRemoteConfigData = UpdateRemoteConfigCacheService.NeedsToUpdateStoredRemoteConfigData(); Assert.IsFalse(needsToUpdateStoredRemoteConfigData); }